Unfortunately, it seems that any SQL Statement resets @@ERROR, and any SET statement resets @@ROWCOUNT.
How then, do I save the values of both at the point immediately after the query has been run?
I started by saving @@ERROR into a local variable using :
Expand|Select|Wrap|Line Numbers
- DECLARE @SaveErr AS int
- DELETE FROM dbo.MyTable
- SET @SaveErr = @@ERROR
I expect I'm approaching this all from the wrong direction, so any advice is welcomed. I'd certainly like to understand how to manage this though, even if bypassing the issue may be the preferred approach.