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 |
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-01-19 : 05:05:13
|
| C1 C2 C3 C4 C5 zcode 12 48 23 02 04 23445Now i need output asC3 48i.e Find out the greatest column number with name.I am able to get value of column, but how to get column name. My query is as follows.SELECT MAX(theValue) as HighvalueFROM Table1 AS t1UNPIVOT (theValue FOR theCol IN (t1.Col1, t1.Col2, t1.Col3, t1.Col4, t1.Col5, t1.zCode) AS uwhere u.zCode = '23445'my ouput is as followsHighvalue48G. Satish |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
ashishashish
Constraint Violating Yak Guru
408 Posts |
Posted - 2009-01-19 : 05:37:58
|
| I think U Posted It Before in Same Forum Do not Post Dupliacte Entries.............U Use Here Peso Sir Solution Here,,,,,,So Dont Post Dupliacte |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-01-19 : 05:51:16
|
| see that peso, peterneo give the column name also in there result setcheck once |
 |
|
|
|
|
|
|
|