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 |
thbaig1
Starting Member
8 Posts |
Posted - 2011-05-04 : 13:20:43
|
Hi,RDBMS : sqlserver 2005OS : windowsI have to write a stored proc, for given below scenarioTable-Aidnamecol1col2col3...colnwe add column for some new values. Col1-n will have only status value "1 or 0 ".Now I want to write a stored proc that should returnid, name and only those col (from col1-n) that have value 1.I can not hard code col name (col1-n) as in future col can increase, so the stored proc should return always right results.can you please help me ? |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-05-04 : 14:44:45
|
Slight problem I foresee: what if col1 has 1 for some rows and 0 for the others?(That's the slight problem. The rather larger problem is the design of this table.) |
 |
|
|
|
|