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)
 CSV for IN()

Author  Topic 

inrsence
Starting Member

48 Posts

Posted - 2001-03-01 : 19:58:38
Hi,

I have a quick question. I'm sure the answer is obvious, but I have to ask.

I'm trying to write a SP that looks like this:

DECLARE @List varchar(100)
SET @List = '1,2,3,4,5'

SELECT Field
FROM Table
WHERE FieldID IN (@List)

I know I can write a sub-query, but it seems senseless to do that when the list is right there.

Anyone know how to do this?

Thanks,
Greg
   

- Advertisement -