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 2000 Forums
 Transact-SQL (2000)
 SP or XP that parses data

Author  Topic 

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2004-11-23 : 19:09:42
Its been sometime so I cant remember the proc name. The proc would accept a delimiter. It would then parse the column into two or however many rows, like a VB array.

So if I had a column with "Business Name-123" or "Business Name#123", I could pass the proc the - or the # in the other example and it would return an array with "Business Name" and "123".

I know this can be done with patindex or charindex so please don't reply about those. I just want to remember the proc that did the parsing as I described.


Thanks,
Daniel

Daniel
SQL Server DBA

robvolk
Most Valuable Yak

15732 Posts

Posted - 2004-11-23 : 19:32:38
There's no system procedure that I'm aware of that does that. The closest I can think of is the PARSENAME() function, but that won't do what you're looking for.

What's wrong with the parsing techniques listed here?

http://www.sqlteam.com/searchresults.asp?SearchTerms=csv
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2004-11-23 : 21:20:01
http://www.nigelrivett.net/ParseCSVString.html

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

SQLServerDBA_Dan
Aged Yak Warrior

752 Posts

Posted - 2004-11-24 : 11:30:47
quote:
Originally posted by robvolk

There's no system procedure that I'm aware of that does that. The closest I can think of is the PARSENAME() function, but that won't do what you're looking for.

What's wrong with the parsing techniques listed here?

http://www.sqlteam.com/searchresults.asp?SearchTerms=csv




No it works.

select parsename(replace(DBA, '#', '.'), 2), parsename(replace(DBA, '#', '.'), 1) from tblClientData


returns "Store Name", "Store Number"


Thanks for the help I always seem to forget that function.


Daniel
SQL Server DBA
Go to Top of Page
   

- Advertisement -