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 |
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-04-21 : 14:22:26
|
| I want an alias instead of display the column name for the below query..select STE = case when STE ='AT' then '01'when STE = 'AT1' then '02'............................ else STE end from tableinfoOutput for the query STE---0102Desired output:STEDN-----0102Thanks for the help in advance !!! |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2008-04-21 : 14:27:45
|
| SELECT STEDN = case when STE = 'AT' then '01'...Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-04-21 : 14:35:49
|
| or:-select case when STE ='AT' then '01'when STE = 'AT1' then '02'............................else STE end AS STEDNfrom tableinfo |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-04-21 : 16:44:26
|
| Thanks Tara Kizer it works.But visakh16 with your query its gives an errorIncorrect syntax near the keyword 'as'. |
 |
|
|
sqlfresher2k7
Aged Yak Warrior
623 Posts |
Posted - 2008-04-21 : 17:10:12
|
| Sorry visakh16!!Your query also worked fine.. |
 |
|
|
|
|
|