In SQL Server 2005, is there a way of deleting rows and being told how many were actually deleted?
I could do a select count(*)
with the s
In your example @@ROWCOUNT
should work - it's a proper way to find out a number of deleted rows. If you're trying to delete something from your application then you'll need to use SET NOCOUNT ON
According to MSDN @@ROWCOUNT function is updated even when SET NOCOUNT is ON as SET NOCOUNT
only affects the message you get after the the execution.
So if you're trying to work with the results of @@ROWCOUNT
from, for example, ADO.NET then SET NOCOUNT ON
should definitely help.