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
 Transact-SQL (2000)
 Using Parms with IN clause

Author  Topic 

peterlemonjello
Yak Posting Veteran

53 Posts

Posted - 2006-05-12 : 16:01:25
Is there a way to use a parm in the 'IN' of a where clause?

Example (integerValue is an int datatype):

declare @list as varchar(max)
set @list = '1, 2, 3, 4'

select *
from table1
where integerValue IN ( @list )

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2006-05-12 : 16:10:29
http://www.sqlteam.com/item.asp?ItemID=11499

Tara Kizer
aka tduggan
Go to Top of Page

peterlemonjello
Yak Posting Veteran

53 Posts

Posted - 2006-05-12 : 16:13:56
Thanks!
Go to Top of Page

mmarovic
Aged Yak Warrior

518 Posts

Posted - 2006-05-13 : 06:55:47
See also: http://www.sql-server-performance.com/mm_list_random_values.asp

Read also discussion there, you can find one more interesting implementation and link to Erland Sommerskog long article about the problem.

Go to Top of Page
   

- Advertisement -