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 IN with a variable

Author  Topic 

Rauk
Starting Member

2 Posts

Posted - 2001-09-24 : 11:41:48
This is what I am trying to do:

DECLARE @id_list VARCHAR(255)
SET @id_list = ''
// some code here...

// now @id_list will look something like '3, 5, 1, 6'

EXEC (' DELETE
FROM MY_TABLE
WHERE ID IN ('+@id_list+')');

This exec statement doesn't work. What should it look like?
Thanx / Andreas

   

- Advertisement -