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.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-10-08 : 01:36:54
|
| Andrei writes "HiI would like to ask how to script a stored procedure(SQL Server2000) whose parameter would be a comma delimited string (eg '14,15,16') and this string would be used as the search-in value for the IN statementto illustrate:@cid='1,2,3'select * from customer where customerid IN (@cid)the above statement doesn't work in SQL Server and i would like to know a workaround on this please... @cid of course is variable(changing)what i thought of was to create a dynamic SQL statement in the stored proc like so...@x as NVARCHAR(1000)SET @x='select * from customer where customerid IN('SET @x = @x + @cid + ')'EXEC(@x)but i thought that you guys could come up with a better way... thanks and eagerly hoping for your response...andrei" |
|
|
|
|
|