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 |
|
cosensp
Starting Member
2 Posts |
Posted - 2007-04-25 : 10:16:25
|
| Hi guys, wondered if anyone could help me out here -I have a table, with columns:id - name - data1 - data2 - data3 - data41 - paul - sswn - sswb - sswc - sswd2 - peter - sswn - sswh - sswt - sswj3 - simon - sswn - sswh - sswc - sswfI need to create a SQL Script to convert this so that, data1, data2, data3 are on seperate rows, e.g.id - name - data1 - paul - sswn1 - paul - sswb1 - paul - sswc1 - paul - sswd2 - peter - sswn2 - peter - sswh ...ThanksPhil |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-04-25 : 10:21:28
|
[code]select id, name, data1 as datafrom tableunion allselect id, name, data2 as datafrom tableunion allselect id, name, data3 as datafrom table. . . .[/code] KH |
 |
|
|
cosensp
Starting Member
2 Posts |
Posted - 2007-04-25 : 10:31:42
|
Thanks alot - thats what I was after. Thought it was something quite simple. |
 |
|
|
|
|
|
|
|