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 |
|
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2010-04-07 : 07:51:03
|
| Hi,I am a parameter that gets a string example: '0976-009,3455-076'.I need to first split the string where the commas are and than by - as i need to insert the values into a table with 2 columns. The result should be:style colour0976 0093455 076Any help would be appreciated.ThanksWhisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-07 : 07:58:00
|
Are the parameters always like this? '0976-009,3455-076'Or is this also possible? '0976-009,3455-076,1234-123,2345-678,9999-878,2222-555' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2010-04-07 : 08:15:17
|
| yea possible alsoWhisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-07 : 09:00:15
|
select parsename(replace(Data,'-','.'),2) as style,parsename(replace(Data,'-','.'),1) as colourfrom dbo.fnParseList(',','0976-009,3455-076,1234-123,2345-678,9999-878,2222-555')And fnParseList is here http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76033 No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
collie
Constraint Violating Yak Guru
400 Posts |
Posted - 2010-04-07 : 09:33:41
|
| Thanks works great :-)Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much. |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-04-07 : 09:35:36
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|
|
|