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 |
|
ramdas
Posting Yak Master
181 Posts |
Posted - 2003-08-05 : 15:25:35
|
| Hi folks,I have a string which is passed to the stored procedure likeA|B|C|D, how do I parse it to get values like ABCDThank youRamdasRamdas NarayananSQL Server DBA |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2003-08-05 : 15:37:01
|
| This artcile should help you:[url]http://www.sqlteam.com/item.asp?ItemID=2652[/url]It shows how to parse CSV values into multiple rows, but just change the comma to a pipe in the code.Tara |
 |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2003-08-05 : 16:25:40
|
| Note that if it is truly only letters and the string is guaranteed to be well-formed, you can do something like this:(assuming you have a table called Numbers with an int called "Number" from 1 - 1000 or so)select substring(@String, (Number-1)*2 +1,1) as LetterfromNumberswhere Number < len(@string) / 2same basics as the article, but much simplier since you are dealing with fixed-length items in the string.- Jeff |
 |
|
|
|
|
|