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 |
ramkirangj
Starting Member
7 Posts |
Posted - 2008-11-18 : 02:11:43
|
I have a table which contains n number of elements and values for them. Some times the value may be 0.I want only the elements whose value is not 0 as columnsCan any one help me out |
|
sakets_2000
Master Smack Fu Yak Hacker
1472 Posts |
Posted - 2008-11-18 : 05:44:36
|
http://weblogs.sqlteam.com/jeffs/archive/2005/05/02/4842.aspx |
 |
|
ramkirangj
Starting Member
7 Posts |
Posted - 2008-11-18 : 08:14:28
|
Thank u very much for the link.I have tried that one but the problem is that procedure is working only for one element in the pivot column. But, I have n number of elements in pivot column.if my table is as followsno Dept no.of employee payelement value1 HR 30 basic 88882 HR 30 HRA 22223 Tech 10 basic 55554 Tech 10 HRA 2222Then i want the output as Sno Dept No.of Employees Basic HRA1 HR 30 8888 22222 Tech 10 5555 2222In stead i am getting the output as Sno Dept No.of Employees HRA1 HR 30 22222 Tech 10 2222That means it is taking only the last element Here i gave only two elements but in real i have total elements of 130 which keep changing from month to monthPlease help me out |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-18 : 08:54:11
|
http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx |
 |
|
ramkirangj
Starting Member
7 Posts |
Posted - 2008-11-21 : 05:21:18
|
Thank you very much for the reply I got the answer |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-21 : 06:24:06
|
welcome |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-21 : 07:26:08
|
quote: Originally posted by ramkirangj Thank you very much for the reply I got the answer
For the first time I have seen this requirement in this forum and happy that my solution worked MadhivananFailing to plan is Planning to fail |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-11-21 : 08:57:27
|
quote: Originally posted by madhivanan
quote: Originally posted by ramkirangj Thank you very much for the reply I got the answer
For the first time I have seen this requirement in this forum and happy that my solution worked MadhivananFailing to plan is Planning to fail
Owe me a treat for this |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-21 : 09:38:19
|
quote: Originally posted by visakh16
quote: Originally posted by madhivanan
quote: Originally posted by ramkirangj Thank you very much for the reply I got the answer
For the first time I have seen this requirement in this forum and happy that my solution worked MadhivananFailing to plan is Planning to fail
Owe me a treat for this 
MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|