sql server - How to get the message of RaiseError of a procedure in another procedure -


i have 2 procedures proc_a , proc_b.

in both procedure transaction managed.

proc_b throws error calling raiseerror , passes message in condition

raiserror ('initiator inactive', 16, 1, 'approve transaction');  

i executing (calling) proc_b in proc_a. want error message thrown proc_b in proc_a.

how can that?

try this:

create procedure dbo.testa begin     raiserror ('initiator inactive', 16, 1, 'approve transaction');  end; go  create procedure dbo.testb begin     begin try     exec dbo.testa;     end try      begin catch     select error_message();     end catch end; go  exec dbo.testb; go  drop procedure dbo.testb; drop procedure dbo.testa; 

Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -