If i am right, the stored procedure will only execute the updates, if non of them(updates) fail.

I will not use the "xact_abort on", because i think that it is no need in this case.

I don't need that the stored procedure stops if it raises any error. i only need that it can not execute any statement, if one of the statements fails.

Is this correct?

If the anwser is yes, then i would like to make other questions about errors in SQL Server 2000.I know that the errors that are raised, have severity levels.

But i don't know if what i will write below is correct:

1 )taking the stored proc test on this post as an e.g, if one of the instructions raises an error with a severity level of 15 or below, then the stored procedure will not stop from executing, it will continue to execute until the last statement, but it will not commit anything to the database because one of the instructions have failed with that severity level.

2) If one of the instructions raises an error of severity level of 16 or bigger, then the stored procedure will not go to the other instructions. It will stop executing.

"Set nocount on" does this instructuction affects the error count (@@error) inside the stored procedure while it is executing?Or the Set nocount on, only affects the lines returned by the stored procedure?

"Set nocount on" does this instructuction affects the error count (@@error) inside the stored procedure while it is executing?Or the Set nocount on, only affects the lines returned by the stored procedure?

I have seen your link. thank youI have seen taht the variable @@error is not affected by the "Set nocount on".

But, what about the:

@declare erro intset @erro =@@erro

The variable that i declared (@erro) is not affected by the "Set nocount on"?

Other question that i have is this:

if @erro=0beginupdate bulk_contribuinteinst set valido_bulk=1,motivo_irregular_bulk =nullwhere nif_antigo in (select rgc1 from CTBS_BULK_VALIDOS_REPETIDOSwhere motivo_irregular_bulk1 ='NIF REPETIDO' and rgc1 not in (select a.rgc1 as rgc from CTBS_BULK_VALIDOS_REPETIDOS as a inner join allctb as b on a.rgc1 <> isnull(b.rgc,-111) and a.nifctb1 =b.nifctb))set @erro=@@errorend

the update is the first line of the instruction , then i have a select.I am putting the "Set @erro=@@error", on the end of the statement, to verify it it went ok (if succeded). Is this correct?, or should the "set @erro=@@error"be afetr the update and befour the select?