i have simple data coming in like this:
declare @string varchar(500) = "val1|val2|val3"
how could i split this out into a cte or something similar so i could user it in a later query:
select col1 from table where col2 = @valFromCTE
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is a helpful and simple way to query a delimited string as if it were a table.
Taken from:
http://www.mindsdoor.net/SQLTsql/ParseCSVString.html