Link to home
Start Free TrialLog in
Avatar of austerhaus
austerhaus

asked on

Select single value from csv string

Hello,

I am using SQL Server 2000.I have a stored procedure that accepts (among other things) a varchar csv string, values that come from an asp multi-select list. In the sproc, i need to set a variable if that csv string contains a specific value. I have a tally table to parse the csv into individual rows but I am yet unable to get it to work

As an example: let's say that the csv string = 'homer, bart, moe, milhouse, apu'
I need logic that will set a var (bit) to true if the csv string contains 'moe' and false if it does not.

Please let me know if additional information is required. Thank you in advance!
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Does the value have to be in the specific column, I assume it does.
Avatar of austerhaus
austerhaus

ASKER

The value I am looking for will not necessarily be in the string. If it is then my var (i.e. @varMoeExists) should be set to true otherwise, it will need to be false.
I think angel got this one, check that out. I am adding that one to my knowledgebase.
Yep, worked great. Thanks for the fast reply!