Rollback Tran in Error Handler sp

  • Hi,

    I am trying to implement a system wide error handle sproc that will be called in the BEGIN/END catch of every stored procedure.

    To keep things clean and concise I check @@TRANCOUNT > 0 in the error handling sp, and if so I rollback.This works fine, the problem is though that the tran count at the start of the sproc was 1, and after it was 0 so SQL Server throws the following error;

    Msg 266, Level 16, State 2, Procedure CMS_HandleError, Line 0

    Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.

    Is there anyway to stop SQL Server from throwing this exception when the current count is less than the previous count?

    Thanks,

    Donal

  • I am facing kind of problem, Any one help us:-)

  • subrammail (2/17/2010)


    I am facing kind of problem, Any one help us:-)

    The original question was from August 2008.

    Tell us about your problem - it's likely to be different.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply