tsql - SQL Server 2000: How to exit a stored procedure? -
How do I get into a stored procedure?
I have a stored procedure where I want to get out quickly (when trying to debug it) I call return
and RAISERROR
Has tried, and keeps the spam running:
creation process dbo.Archive_Session @ session sheet unique identifier as print, after print '' after '' print '' print Before 'Returner 1' after the 'Return' print, because I got an error in front I do not see any of my print if I comment on the bulk of the stored procedure: Arvive Session @ Centrint Print as Unique Identifier 'before riot' raiserror ('This is a serious error', 18, 1) Print 'before return' returns -1 print 'return' / * [snip] * /
Then I have not found my error, and I see the result:
first raiserror server: message 50000, level 18, state 1, process Archive_Session, line 5 This is a return error
So the question is: How do I bail SQL sir Out of a stored methodology in the frame?
You can use return
execution of a stored procedure immediately closed Taken from the quote:
Unqualified by a query or process The return is instant and complete and can be used to exit any process, batch or statement block at any time The returns that follow the returns are not executed.
Out of paranoid, I tried an example and printed it and immediately stopped execution.
Comments
Post a Comment