I have 2 procedures.
1 procedure calls second procedure and in second procedure I use raise error
statement:
RAISEEROR(60005,1,1)
But first procedure doesn't get an error, @.@.error=0, so transaction in first
procedure is not rolled back.
Any idea?
I can use parameter like this:
exec @.eror=firstProcedureName
if @.eror=1 then
begin
ROLLBACK TRAN
RETURN
end
and in 2 procedure I return 1, if error is done.
But I wonder is there any automation?
Simonsimon
RAISERROR is intend for information messages not for ERRORS. Also look up
for NESTED operations in the BOL
"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:e2Y7jRHKFHA.1396@.TK2MSFTNGP10.phx.gbl...
> I have 2 procedures.
> 1 procedure calls second procedure and in second procedure I use raise
error
> statement:
> RAISEEROR(60005,1,1)
> But first procedure doesn't get an error, @.@.error=0, so transaction in
first
> procedure is not rolled back.
> Any idea?
> I can use parameter like this:
> exec @.eror=firstProcedureName
> if @.eror=1 then
> begin
> ROLLBACK TRAN
> RETURN
> end
> and in 2 procedure I return 1, if error is done.
> But I wonder is there any automation?
> Simon
>|||What? From BOL, "Returns a user-defined error message and sets a system
flag to record that an error has occurred. "
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23YevxzHKFHA.4056@.TK2MSFTNGP14.phx.gbl...
> simon
> RAISERROR is intend for information messages not for ERRORS. Also look up
> for NESTED operations in the BOL
> "simon" <simon.zupan@.stud-moderna.si> wrote in message
> news:e2Y7jRHKFHA.1396@.TK2MSFTNGP10.phx.gbl...
> error
> first
>|||Your severity is not "high" enough to automatically cause the error logic.
Either use a higher severity or use the seterror option.
raiserror (60005,1,1)
select @.@.error
raiserror (60005,11,1)
select @.@.error
raiserror (60005,1,1) with seterror
select @.@.error
"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:e2Y7jRHKFHA.1396@.TK2MSFTNGP10.phx.gbl...
> I have 2 procedures.
> 1 procedure calls second procedure and in second procedure I use raise
error
> statement:
> RAISEEROR(60005,1,1)
> But first procedure doesn't get an error, @.@.error=0, so transaction in
first
> procedure is not rolled back.
> Any idea?
> I can use parameter like this:
> exec @.eror=firstProcedureName
> if @.eror=1 then
> begin
> ROLLBACK TRAN
> RETURN
> end
> and in 2 procedure I return 1, if error is done.
> But I wonder is there any automation?
> Simon
>|||Scott
I mean 'Info' to inform the end-users about the error and not returning
actual error message.
"Scott Morris" <bogus@.bogus.com> wrote in message
news:u88agtJKFHA.2628@.tk2msftngp13.phx.gbl...
> What? From BOL, "Returns a user-defined error message and sets a system
> flag to record that an error has occurred. "
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:%23YevxzHKFHA.4056@.TK2MSFTNGP14.phx.gbl...
up
>|||It CAN be used to generate an informational message, but it is not limited
to such usage. When the proper invocation is used, the client application
sees the error in the same manner as any other dbms error (e.g., a
constraint violation).
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:%23T8dF%23JKFHA.2728@.TK2MSFTNGP10.phx.gbl...
> Scott
> I mean 'Info' to inform the end-users about the error and not returning
> actual error message.
>
> "Scott Morris" <bogus@.bogus.com> wrote in message
> news:u88agtJKFHA.2628@.tk2msftngp13.phx.gbl...
look
> up
raise
in
>sql
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment