set xact_abort

set xact_abort

Post by N » Tue, 26 Mar 2002 17:09:09



hi

if i do a set xact_abort on at the beginning of a stored procedure
and i still do error handling after a sql statement in the following manner:

    update sql

    begin
      raiserror ('Error: Failure to insert new notional price into
client_benefit.',10,1)
      rollback tran
      return
    end

will this error handling still be executed if an error happens in the sql
statement associated with it??

thanks
nesaar

 
 
 

set xact_abort

Post by Guy van den Ber » Tue, 26 Mar 2002 18:16:22


Quote:> will this error handling still be executed if an error happens in the sql
> statement associated with it??

No, XACT_ABORT terminates the entire batch as soon as an error occurs.

HTH,
g.

 
 
 

set xact_abort

Post by Mark Alliso » Tue, 26 Mar 2002 18:17:53


SET XACT_ABORT ON causes SQL Server to stop processing and
ROLLBACK the entire batch.

Therefore your code after the update statement would never
get executed in the event of an error.

Mark.
www.allisonmitchell.com

Quote:>-----Original Message-----
>hi

>if i do a set xact_abort on at the beginning of a stored
procedure
>and i still do error handling after a sql statement in

the following manner:

>    update sql

>    begin
>      raiserror ('Error: Failure to insert new notional
price into
>client_benefit.',10,1)
>      rollback tran
>      return
>    end

>will this error handling still be executed if an error
happens in the sql
>statement associated with it??

>thanks
>nesaar

>.

 
 
 

1. SET XACT_ABORT in 6.5

I have a table which is the target of foriegn key references.   During
the course of a days operations, some elements in this table may become
unreferenced by any other table.   I would like to remove all entries
from this table which are not linked via FK to another table.     Under
7.0 a quick way to do this is to ...

set xact_abort off
delete from <table name>
set xact_abort on

How can I efficiently do this under SQL6.5 (which does not appear to
have xact_abort in its set command).

Thanks
Jim

2. Mdac

3. How to SET XACT_ABORT ON for all procedures?

4. SQLMaint config advice requested (example provided)

5. SET XACT_ABORT just doesn't work...

6. Problem with character ' (single quote) in text fields

7. does set xact_abort off sometimes hang server?

8. How to set XACT_ABORT in user options

9. DDL statement and SET XACT_ABORT

10. How to catch error in SQL with SET XACT_ABORT ON

11. Correct placement of SET XACT_ABORT ON

12. SET XACT_ABORT Question