Reputation: 27021
declare @inserted bit
declare @removed bit
I know it's possible to set them like below:
SELECT @inserted = 0, @removed = 0
but would it be possible to make this even simpler and use something like:
SET @inserted, @removed = 0
Many thanks
Upvotes: 16
Views: 29101
Reputation: 755541
How about:
declare @inserted BIT = 0, @removed BIT = 0
Works in SQL Server 2008 and up (you didn't specify which version of SQL Server....)
Update: ok, so you're stuck on SQL Server 2005 - in that case, I believe this is the best you can do:
DECLARE @inserted BIT, @removed BIT
SELECT @inserted = 0, @removed = 0
Upvotes: 27
Reputation: 338426
but would it be possible to make this even simpler and use something like:
SET @inserted, @removed = 0
I suppose yo mean
SET @inserted = @removed = 0
No, that is not possible. T-SQL does not support this kind of syntax.
Upvotes: 1