Trace/Log Transaction Rollback

  • Hello,

    I am looking for a good (if any) way to log the event of transaction rollback. I'am on SQL2008 R2 Standart.

    Situation:

    Transaction is opened from .NET application. Request timed out. Transaction (in SQL) has been rolled back by the application.

    No errors happened on the SQL side, so I have nothing to log in the CATCH.

    Is there any way to log the event of the rollback itself (like we do for dead locks for example)? With or without details (e.g ID, time).

    Thanks,

    Greg

  • Greg Shinder (3/25/2013)


    Hello,

    I am looking for a good (if any) way to log the event of transaction rollback. I'am on SQL2008 R2 Standart.

    Situation:

    Transaction is opened from .NET application. Request timed out. Transaction (in SQL) has been rolled back by the application.

    No errors happened on the SQL side, so I have nothing to log in the CATCH.

    Is there any way to log the event of the rollback itself (like we do for dead locks for example)? With or without details (e.g ID, time).

    Thanks,

    Greg

    I am assuming you mean the request timed out because you reached the SqlCommand.CommandTimeout? If so, then you should be able to catch an exception in .NET. See the example code here:

    http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Thanks for reply.

    The problem is that .net is out of reach. I am looking for something on sql side.

  • The SQL is only doing what it is told to do by the .NET, i.e. to end the session because the .NET gave up waiting and closed it's connection. There is not much you can do in that situation in SQL because .NET is the client.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

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

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