Accessing values of comma delimited string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishakha209
    New Member
    • Nov 2006
    • 1

    Accessing values of comma delimited string

    I want to use comma delimited string as an input for stored procedure. how to delimit the string and access the values? can anybody help ....
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by vishakha209
    I want to use comma delimited string as an input for stored procedure. how to delimit the string and access the values? can anybody help ....

    Depends on how you will use the string. If it will be used as an IN set list (WHERE column in @yourvar), you can just replace your delimiter with a new one (quote-comma-quote, then add a quote in both side of the string). If you need each individual value, you have to parse it

    That would be a combination of LEN, RTRIM, LTRIM, SUBSTRING. Here's the list of String Functions available in SQL Server.

    Good luck.

    -- CK

    Comment

    Working...