I have always used rowcount (hang over from Sybase days)
But using top in the delete would save doing the rowcount. I've forgotten the set rowcount a enough times that using top would help deleting the whole table.
I like your solution better than the author's for one more reason, it doesn't use count(*), as noted the tables could be huge, and count(*) would then be very expensive.
mu_rauer (7/3/2008)
I am wondering, why not use SET ROWCOUNT ?Normally I am using rowcount because it is really easy to handle.
Set Rowcount @n
select 1
While @@ROWCOUNT > 0
BEGIN
Delete from .... where x = y
END
Should do the same without too much calculation and too many variables :hehe: