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)
 Convert 1 Row into Multiple rows

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2007-02-12 : 10:00:47
Christian writes "Christian writes "I hope you stop laughing at my question long enough to help..........

I have a row that contains a column with multiple values separted by an <ENTER> sign.

I need to separate this row into multiple rows.

Any help would be greatly appreciated"

AjarnMark
SQL Slashing Gunting Master

3246 Posts

Posted - 2007-02-12 : 10:00:47
Search the site for articles on CSV. You should be able to apply the technique to your situation. It's a fairly common problem.
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-12 : 10:05:24
Can be a little tricky.
<ENTER> is sometimes both <CR> and <LF> characters, and sometimes <LF> only.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-12 : 10:47:39
so you replace char(10) with char(13) before prcessing:

select replace(replace(col1, char(10), char(13)), char(13)+char(13), char(13))
from table





Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page
   

- Advertisement -