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 |
|
spshindagi
Starting Member
11 Posts |
Posted - 2008-01-29 : 02:19:20
|
| hello,i have the following tablesno Accsno a1 a2 a3 a4 b1 b2 b3 b4.........z1 z2 z3 z41 aa1 0 2 0 A 1 0 3 B 1 2 3 Z2 aa1 1 0 3 A1 0 2 0 B1 0 0 0 Z13 aa2 0 2 0 A 1 0 3 B 1 2 3 Z4 aa2 1 0 3 A1 0 2 0 B1 0 0 0 Z1@param1="1,2,3"and param2="a1,b1,a2,c2" and param3="aa1"i wanted to retirve a4 if a1='1' b4 if b1='1' a4 if a2='2' c4 if c2='2'i.e dynamically selection of column namelove all |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2008-01-29 : 02:27:52
|
maybe Dynamic SQL ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
sunil
Constraint Violating Yak Guru
282 Posts |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2008-01-30 : 02:14:15
|
| The alternative is using CASE in your SELECT statments - this would still return the columns , but you could manage the values returning in the columnsJack Vamvas--------------------Search IT jobs from multiple sources- http://www.ITjobfeed.com |
 |
|
|
|
|
|