Home Forums SQL Server 7,2000 T-SQL Forcing Exception logging not be SUBJECT to ROLLBACK inside a transaction RE: Forcing Exception logging not be SUBJECT to ROLLBACK inside a transaction

  • When the outer transaction is rolled back does not it roll back all modifications, irrespective of any commits by the inner transactions? It makes no difference whether you have transactions in the procedure. (as shown below)

    create table logger (logentry varchar (30))

    go

    create proc Testproc @entry varchar(30) as

    begin tran

    insert into logger values (@entry)

    commit tran

    go

    begin tran

    insert into logger values ('Outer')

    exec Testproc 'Inner'

    select * from logger

    Output

    ======

    logentry                      

    ------------------------------

    Outer

    Inner

    (2 row(s) affected)

    rollback tran

    select * from logger

    logentry                      

    ------------------------------

    (0 row(s) affected)