Showing posts with label agent. Show all posts
Showing posts with label agent. Show all posts

Friday, March 30, 2012

How to trap EXECUTE failure

We are running SQL 2000 sp3a on Win2003 Server with all patches and SPs applied.

I want to run a stored procedure from a SQL Agent job. I want the stored procedure to run as a TRANSACTION to force a ROLLBACK in case of failure. However, if execute the procedure and an error of severity level 20 (I think) or greater happens I get blown out of the job immediately. Therefore I cannot call RAISEERROR or use @.@.ERROR. So, how do I assure that I can ROLLBACK the TRANSACTION?

I have searched the web and BOL and cannot find anything that addresses this specifically.

Thanks in advance for any help.Severity level 20 indicates a fatal error that the session encountered. The batch terminates and the connection is severed. The fate of your transaction is predetermined, - it will roll back. You (your spid) cannot roll it back with ROLLBACK because the batch execution will not reach that point.

Wednesday, March 21, 2012

How to tell what was deleted during synch

Warren,
have a look at my script here:
http://www.replicationanswers.com/Merge.asp
This gives the ability to see pending changes. Once the
merge agent has run, the records have been deleted, so by
then it's too late, unless you want to use LogExplorer.
HTH,
Paul Ibison SQL Server MVP,
www.replicationanswers.com/default.asp
(recommended sql server 2000 replication book:
http://www.nwsu.com/0974973602p.html)
Thanks Paul, much appreciated.
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:039301c53503$4d549510$a401280a@.phx.gbl...
> Warren,
> have a look at my script here:
> http://www.replicationanswers.com/Merge.asp
> This gives the ability to see pending changes. Once the
> merge agent has run, the records have been deleted, so by
> then it's too late, unless you want to use LogExplorer.
> HTH,
> Paul Ibison SQL Server MVP,
> www.replicationanswers.com/default.asp
> (recommended sql server 2000 replication book:
> http://www.nwsu.com/0974973602p.html)
>