I need to find the amount of updated rows
UPDATE Table SET value=2 WHERE value2=1
declare @aaa int
set @aaa = @@ROWCOUNT
It doesn't work. How can I do that?
I need to find the amount of updated rows
UPDATE Table SET value=2 WHERE value2=1
declare @aaa int
set @aaa = @@ROWCOUNT
It doesn't work. How can I do that?
You may want to declare before you do the update. I am not sure but declare statement might affect @@rowcount.
You are not getting the @aaa value back - you want to select
it out if you want to see it outside the query
.
declare @aaa int -- this name's noty the best... use @row_count instead ;)
UPDATE Table SET value=2 WHERE value2=1
set @aaa = @@ROWCOUNT
select @aaa