Assign a list of integers to an @var

Posted by justSteve on Stack Overflow See other posts from Stack Overflow or by justSteve
Published on 2010-04-07T11:08:58Z Indexed on 2010/04/07 11:13 UTC
Read the original article Hit count: 179

Filed under:

I can:

declare @idOrder int set @idOrder = 21319

I want:

declare @idOrder int set @idOrder = (21319, 21320)

for use in a series of statements where the 'WHERE' clause uses the IN operator

delete Orders where idOrder in @idOrder

instead of

delete Orders where idOrder in (21319, 21320)

© Stack Overflow or respective owner

Related posts about tsql