In SQL Server 2005, is there a way to delete rows and find out how many of them are really deleted?
I could do select count(*) with the same conditions, but I need this to be absolutely reliable.
My first assumption was to use @@ROWCOUNT variables, but this is not set, for example.
delete from mytable where datefield = '5-Oct-2008' select @@ROWCOUNT
always returns 0.
MSDN offers an OUTPUT construct, for example.
delete from mytable where datefield = '5-Oct-2008' output datefield into
it really is not with a syntax error.
Any ideas?
sql-server tsql sql-delete audit
Unsliced Oct 06 '08 at 12:56 2008-10-06 12:56
source share