Exclude from transaction

  • Is there a way to exclude a t-sql statement from a transaction?

    I have a stored procedure called from another programm.

    The calling programm starts a transaction and roll it back if an error occurs.

    My stored procedure consists of update statements and some audit code.

    When the transaction is rolled back, my audit code is also rolled back.

    Can I exclude my audit code from the transaction?

  • Not that im aware of. This is a fundamental requirement for transaction consistency.

    Chris Kempster

    http://www.chriskempster.com

    Author of "SQL Server 2k for the Oracle DBA"


    Chris Kempster
    www.chriskempster.com
    Author of "SQL Server Backup, Recovery & Troubleshooting"
    Author of "SQL Server 2k for the Oracle DBA"

  • What about moving your audit code to just after the transaction. This way you it is not rolled back if a problem arises. But, on a different track, if a transaction was rolled back, why do you want to keep the audit trail of something that does not exist?

    Dave

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

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