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)
 Split Function

Author  Topic 

Kabotoro
Starting Member

1 Post

Posted - 2009-05-21 : 14:17:57
Does anyone has a split function that I can use to split a string into two columns. Below is my string.

@pp = '1~600|2~400|3~900|4~100'

I would like to split the string first using the pipe to have one part of the string and then split that part of the string using tilde and insert two columns in the table.

eg

ID Amount
1 600
2 400
3 900
4. 100

Any help will be appreciated

Thanks
KB

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-05-21 : 14:53:27
See http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033

You want to cross apply dbo.fnParseList and use pipe as delimeter anf then use dbo.fnParseString to split the remaining string at the tilde character.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -