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 |
|
mhdmehraj
Starting Member
6 Posts |
Posted - 2010-04-08 : 06:02:57
|
| Hi all,i need to unpivot a multiple tables , so i need to incorporate the unpivote query into a stored procedure , with the input parameter as table name .select * from test; IDNO A B C---------- ---------- ---------- ---------- 1 1 2 3 2 4 5 6 3 7 8 9my output should be like COL_ROW COL_name VALUE---------- ---- ---------- 1 A 1 1 B 2 1 C 3 2 A 4 2 B 5 2 C 6 3 A 7 3 B 8 3 C 9 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-08 : 06:09:29
|
| Start withselect IDNO,'A' as col_name, A as col_value from tableunion allselect IDNO,'B' as col_name, B as col_value from tableunion allselect IDNO,'C' as col_name, C as col_value from tableMadhivananFailing to plan is Planning to fail |
 |
|
|
mhdmehraj
Starting Member
6 Posts |
Posted - 2010-04-08 : 06:11:05
|
| can u please elaborate it |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-04-08 : 06:13:11
|
quote: Originally posted by mhdmehraj can u please elaborate it
Run the individual queries and you may get an ideaMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|