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.
| Author |
Topic |
|
Maharisi
Starting Member
19 Posts |
Posted - 2008-11-25 : 10:07:42
|
| I have table, which has a column isHired [bit].I want create a Select statment where substitute bit column by YES/NO.Thanks |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-25 : 10:08:31
|
| Use Case when.... |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-11-25 : 11:02:04
|
| SELECT CASE WHEN ishired = 1 THEN 'YES' ELSE 'NO' END AS 'IsHired'FROM TABLE |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-25 : 11:26:29
|
quote: Originally posted by raky SELECT CASE WHEN ishired = 1 THEN 'YES' ELSE 'NO' END AS 'IsHired'FROM TABLE
please dont use '' for alias names |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-11-25 : 11:39:22
|
quote: Originally posted by visakh16
quote: Originally posted by raky SELECT CASE WHEN ishired = 1 THEN 'YES' ELSE 'NO' END AS 'IsHired'FROM TABLE
please dont use '' for alias names
Hi Visakh,Is there any specific reason for not using Quotes for Alias Names?? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-25 : 11:46:50
|
| it really creates confusion when you've string literals also alone with fields in select list,especially when you dont use AS before alias. SO its better not to add '',"" etc to aliases. you may use [] if you want. |
 |
|
|
|
|
|