Hi,
I've got a problem with passing a particular parameter from ASP to a SQL Server stored procedure. The problem is this;

ASP code generates a SQL statement;

lstrSQL = "GetMyData 5,4,'param', '1,2,3,4'

where '1,2,3,4' are ID's of some checkboxes. Obviously I cna't put them outside of '' because then that would extra parameters which is not what I want.

I then run the stored procedure. What I then have in my stored procedure is;

dbo.GetMyData
@id int,
@id2 int,
@mystring varchar(10),
@myinlist varchar(50)

SELECT * FROM data WHERE id IN(@myinlist)

but this doesn't work because @myinlist is '1,2,3,4' I can convert the id to a varchar to match;

SELECT * FROM data WHERE convert(Varchar(8), id) IN (@myinlist)

but that's no good because the inlist doesn't match up either
If I try and pass the string in as

'1','2','3','4' by using

lstrSQL = "GetMyData 5,4,'param', '''1'',''2'',''3'',''4'''

then that doens't work either.

Is there any simple way for me to do it ? Is it going to be easiest to build a SQL string and then execute the SQL inside the stored procedure ?

cheers
Andy