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)
 Pass comma delimited string to stored procedure and use them for WHERE.....IN But not EXEC way

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-10 : 08:11:27
Minal writes "I have a comma delimited string that I wish to pass to a SQL Server 7.0 Stored Procedure, ex. '1,2,3,4'. I wish to then use this within the where clause like,

select * from table where idno in (@stringpassed).

I do not want to do the same using EXEC. Is there any other way to achieve the same?"

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-08-10 : 08:24:23
You can modify this method:

http://www.sqlteam.com/item.asp?ItemID=2652

Instead of having INSERT INTO...SELECT...FROM tally... you'd have something like:

select * from table where idno in (SELECT...FROM tally...)

Go to Top of Page
   

- Advertisement -