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 |
|
mibheenick
Starting Member
12 Posts |
Posted - 2004-09-27 : 04:07:06
|
| Hi evryone out there! First of all Thanx very much for the Urgent replies i got last time out....it was real helpful!here's another one though :-)Say i have several Binary columns in a table which can take only values 'O' or 'N'... I want a select statement which returns me only the NAMES OF THE COLUMNS where the value is 'O' for each row in the table...I leave it to god..... |
|
|
Kristen
Test
22859 Posts |
Posted - 2004-09-27 : 04:27:08
|
| [code]SELECT MyPkColumn, CASE WHEN MyCol1 = 'O' THEN 'MyCol1 ' ELSE '' END + CASE WHEN MyCol2 = 'O' THEN 'MyCol2 ' ELSE '' ENDFROM dbo.MyTableWHERE MyCol1 = 'O' OR MyCol2 = 'O'[/code]Kristen |
 |
|
|
|
|
|