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
 Conditional Display

Author  Topic 

xrum
Yak Posting Veteran

87 Posts

Posted - 2011-01-10 : 15:28:31
Hi,

i have an "active" field in the database that has the words "active" and "inactive" in it

how can i do i select, to only show Y and N, depending on the "active"/"inactive" wording in that field?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2011-01-10 : 15:49:38
Use CASE: CASE WHEN Column4 = 'Active' THEN 'Y' ELSE 'N' END

If you want to restrict the data, then add a WHERE clause.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -