May 1, 2007 at 7:46 am
Hi,
I have nested stored procs called within a transaction and where there is some error, I would like to log the errors into a database table.But on error, transaction will rollback which also removes logged error rows from logging tables.How can I prevent those error rows in the logging tables from being not rollback?
Any help?
Thanks,
Jp
May 2, 2007 at 1:21 am
Catch the stuff you want to log inside a Variable. After the rollback you can still insert from that variable - it does not get emptied.
Andreas
---------------------------------------------------
MVP SQL Server
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master Data Platform, SQL Server 2012
www.insidesql.org/blogs/andreaswolter
www.andreas-wolter.com
May 2, 2007 at 8:50 am
Try using BEGIN transaction at the start of the SP, then check for @@ERROR and @@ROWCOUNT to check for errors. You can then output/write to a table any errormessages before issuing a rollback manually.
Dave
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply