Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 change output as YES or NO

Author  Topic 

anilkumarkatta
Starting Member

7 Posts

Posted - 2010-03-21 : 14:09:41
Hi SQLGeeks

I am wondering, how I can change the output of the following querry

Select * from employeeDB
s
which returns all the coloums. i have a coloum as ActiveStatus which returns 0 as active state and 1 as deactive state

I want my extract showing ActiveStatus as Yes or No isteam of 0 n 1

Can any one suggest

Thanks & Regards,
-Anil Katta

Sachin.Nand

2937 Posts

Posted - 2010-03-21 : 14:25:41
select *,case ActiveStatus when 1 then 'Yes' else 'No' end as state from EmployeeDB

PBUH
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-21 : 14:27:40
[code]
select
case
when ActiveStatus = 0 then 'Yes'
when ActiveStatus = 1 then 'No'
else 'unknown'
end as ActiveStatus,
other columns...
from table
where ...
[/code]


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-03-21 : 14:28:37



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -