467,917 Members | 1,278 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,917 developers. It's quick & easy.

Is there a way to split the contents of a string?

I have a string of the form '_10_245_' of varchar type to represent a list of integers.

Is there a way to extract the numbers out of that string?

examples of the string:

'_34_'

'_123_78_'

'_34_155_134_'

I manged to convert the string into the form of '34 155 134' using replace , ltrim and rtrim...but what should I do next?How can I split that string? As soon as I do that, I will convert each substring into int using the cast function.

Also note that the string it's not always the same; there's a column in a table containing those strings as its values.

Each of those numbers is a code and exists in another table A in an int column. Table A also provides each code's description in a varchar column.

I want to match each number in my string to its description in table A.

Any suggestions?

Thanks in advance
Nov 18 '08 #1
  • viewed: 1073
Share:
1 Reply
ck9663
Expert 2GB
You have a "_" delimited string.

Option 1:

Parse it with a lot of substring or loop.

Option 2:
Use this technique.

-- CK
Nov 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

5 posts views Thread by Stu Cazzo | last post: by
2 posts views Thread by merrittr | last post: by
3 posts views Thread by Tempo | last post: by
12 posts views Thread by Jay | last post: by
11 posts views Thread by Brian | last post: by
12 posts views Thread by garyusenet | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.