Simple IF...Else Statement to convert 1/0 to Yes/No
Posted on 2008-06-25
I am new to T-SQL and am using reporting services to create reports from the database. However, the database shows a field called Active as 1 or 0. I want it to say Yes if 1 is shown and No if 0 is shown. I dont want to update the database to Yes or No but keep that 1/0 although when i want to report that field, i want to show Yes/no
This is my query as of now.
IF ( SELECT active from dbo.user where active ='1') = '1'
Select active from dbo.user where active = '1'
IF (Select active from dbo.user where active ='0') ='0'
The Error says - MSG 512 Subquery returned more than 1 value. This is not permitted when the subquery follows =,!=,... or when the subquery is used as an expression.
I am sorry as i am new to this and probably have it all wrong. Please advice it will be greatly appreciated.