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)
You can't do that as long as it's an int
, as that's not a valid value for that datatype. A datatype that could take several integers is a table
declare @idOrder table (id int)
insert into @idOrder values(21319)
insert into @idOrder values(21320)
delete from Orders where idOrder in (select id from @idOrder)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With