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 |
|
simondeutsch
Aged Yak Warrior
547 Posts |
Posted - 2011-12-07 : 11:20:44
|
| What is the simplest way to select all columns from a view, except one column which needs a CASE statement but needs to be aliased to the same name as the column name? Is there a way to do this without listing all the column names? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-12-07 : 11:35:24
|
| no way other than listing all the individual columns------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2011-12-08 : 03:43:12
|
| You can do something like this and use the resultselect case when column_name='name' then 'case when column_name=''name'' then ''yes'' else ''no'' end ' else column_name end+',' as column_name from information_schema.columns where table_name='spt_values'MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|