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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Concantenating associated records

Author  Topic 

OldMySQLUser
Constraint Violating Yak Guru

301 Posts

Posted - 2008-03-12 : 15:55:29


I have a table which contains associated records which contain a sequence number:

id name sequence text1 text2 text3 text4
-- ---- -------- ----- ----- ----- -----
101 Smith 1 Here is some text
214 Brown 1 Some text null null
101 Smith 2 which I have input
101 Smith 3 for you null null
342 White 1 A little prose

I want to create a new table and input records from the original table so that any records which contain sequence numbers greater than 1 have the text field(s) concantenated. This will need the text to be trimmed first, as there may be unwanted trailing spaces due to a previous csv file conversion.

The new table will be:

id name text
-- ---- ----

101 Smith Here is some text which I have input for you
214 Brown Some text
342 White A little prose

How can I accomplish this please? This is beyond my current ability.


spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2008-03-12 : 15:58:55
http://weblogs.sqlteam.com/mladenp/archive/2007/06/01/60220.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
SSMS Add-in that does a few things: www.ssmstoolspack.com
Go to Top of Page
   

- Advertisement -