Author |
Topic |
David92595
Starting Member
8 Posts |
Posted - 2012-11-29 : 20:19:07
|
Hello,Not sure if there is any basic info you need to know...I'm running SQL Server 2008 Standard.I need to create a query that has data from multiple columns (Columns 1-6 with coresponding Date started and Date Completed data) displayed vertically, but also has the column name the preeceeding column to identify it...along with other data (Record number, status).Record Number, Status, Column Name, Date Started, DateCompleted1, Open, Column 1, 1/1/2012, 2/1/2012,2, Hold, Column 2, 1/3/2012, 3/1/2012,1, Open, Column 3, 2/5/2012, 4/6/2012,3, Closed, Column 4, 5/10/2012, 7/25/2012,2, Hold, Column 5, 3/9/2012, 4/1/2012,1, open, Column 6, 10/10/2012, 12/12/2012,Please reply with any question you may have. Sorry, I did the best I could to describe what I need, the formating wasn't helping either. I went with CSV, if it helps.As Always, any help would be greatly apprechated.Thank you,David92595 |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2012-11-29 : 21:31:11
|
Can you explain with expected output? |
|
|
David92595
Starting Member
8 Posts |
Posted - 2012-11-30 : 12:39:56
|
By Horizontal I mean Column 1 -6 would be normal columns in a table.I need to take a normal table Column1,Column2,Column3,Column14,Column5,Column6, Date Started, DateCompletedData, Data, Data, Data, Data, Data, Data, Data,Data, Data, Data, Data, Data, Data, Data, Data,Data, Data, Data, Data, Data, Data, Data, Data,With data in each column and turn it intoColumn Name,Date Started, Date CompletedColumn1,data, data,Column2,data, data,Column3,data, data,Column4,data, data,Column5,data, data,Column6,data, data,Hope this helps explain thing a bit better,David92595 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2012-11-30 : 14:25:55
|
Check for UNPIVOT and you can find lots of post for it. |
|
|
|
|
|