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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Extract a CSV string to integer components

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-10-03 : 10:02:18
Matt Law writes "Hi,

I'm completely new to TSQL, and i've hit a brick wall with something I am trying to do...

I've constructed a stored procedure that will query several tables and return the rows.. However, I want to filter these rows by values in just one column.

This is where it gets complicated... The number of values I wish to compare against this column during any given execution is 1..n - So I'm using an In (n,n,n,n,n,n) statement.

-- THIS IS WHERE I AM STUCK --

This CSV list that I want to use in my IN statement (generated from a listbox using ASP). I can only pass into the stored procedure a varchar containing the list of values...

SQL server rightly complains about the different datatypes in the expression... I think instead of IN (n,n,n,n) its attempting IN ('n,n,n,n') - How do i get from 'n,n,n,n' to n,n,n,n?

I am really stuck... I may revert to a dynamic SQL statement triggered from ASP, where I can construct this statement with ease.

Thanks in advance,

Matt Law"
   

- Advertisement -