Comments
1 comment
-
The point of the error is that your procedure in its entirety isn't encapsulated in a BEGIN/END block, not the entire statement. What it is looking for you to do is this;
CREATE OR ALTER PROCEDURE #ST003_EXAMPLE AS BEGIN BEGIN PRINT 'Great'; END; -- some debug after END... THROW 50000, 'Really!', 1; END; GO -- Separated statement for easy executing whole window from SSMS EXECUTE #ST003_EXAMPLE;
Add comment
Please sign in to leave a comment.
This example will of course throw error. Why? Because procedure (and trigger) body is whole statement (in this example separated by GO). NOT BEGIN..END subpart. This can lead to serious errors.