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 |
curious
Starting Member
8 Posts |
Posted - 2009-01-14 : 23:16:51
|
I'm hoping someone could help me with my query.I have a table with two columnsparagraph# text1 "line one"1 "line two"1 "line three"2 "another line 1"2 "another line 2"I need to join the text lines in each paragraph together and insertthen into another table asparagraph# text1 "line one" + char(13)+"line two"+char(13)+"line three"2 "another line 1"+char(13)+"another line2"any suggestions would be greatly appreciated. |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-15 : 00:09:54
|
Duplicatehttp://www.sqlteam.com/forums/topic.asp?TOPIC_ID=117867 |
|
|
Nageswar9
Aged Yak Warrior
600 Posts |
Posted - 2009-01-15 : 23:25:06
|
DECLARE @temp table(parano int,text varchar(20) )insert into @tempSELECT 1, '"line one"' union allSELECT 1,'"line two"' union allSELECT 1, '"line three"' union allSELECT 2, '"another line 1"' union allSELECT 2, '"another line 2"'SELECT DISTINCT t.parano,STUFF((SELECT '+'+ [text] FROM @temp WHERE parano=t.parano FOR XML PATH('')),1,1,'')FROM @temp t |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-01-16 : 00:19:22
|
quote: Originally posted by Nageswar9 DECLARE @temp table(parano int,text varchar(20) )insert into @tempSELECT 1, '"line one"' union allSELECT 1,'"line two"' union allSELECT 1, '"line three"' union allSELECT 2, '"another line 1"' union allSELECT 2, '"another line 2"'SELECT DISTINCT t.parano,STUFF((SELECT '+'+ [text] FROM @temp WHERE parano=t.parano FOR XML PATH('')),1,1,'')FROM @temp t
this is same solution i provided in other link. please dont repeat solutions |
|
|
|
|
|
|
|