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 |
|
bsnapool
Starting Member
2 Posts |
Posted - 2008-05-15 : 04:49:48
|
| Hi, I am a newbie to this site and hope someone can help....I have a select statement which I would like to create an extra column and put an if statement in it.... Current syntax is:if(TL_flag= '1', "yes") as [Trial Leave]it is coming up with an error.... I can use Select case but I should not need to as this should work?Any ideas? |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-05-15 : 05:05:27
|
quote: Originally posted by bsnapool Hi, I am a newbie to this site and hope someone can help....I have a select statement which I would like to create an extra column and put an if statement in it.... Current syntax is:if(TL_flag= '1', "yes") as [Trial Leave]it is coming up with an error.... I can use Select case but I should not need to as this should work?Any ideas?
use case statementCASE WHEN TL_Flag = 1 THEN 'YES' ELSE 'NO' END AS TRIAL LEAVE |
 |
|
|
bsnapool
Starting Member
2 Posts |
Posted - 2008-05-15 : 05:13:29
|
| Worked. Thanks |
 |
|
|
|
|
|