I have seen your link. thank you
I have seen taht the variable @@error is not affected by the "Set nocount on".
But, what about the:
@declare erro int
set @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=0
begin
update bulk_contribuinteinst set valido_bulk=1,motivo_irregular_bulk =null
where nif_antigo in
(select rgc1 from CTBS_BULK_VALIDOS_REPETIDOS
where 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=@@error
end
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?