ST003 - Entire procedure body not enclosed within BEGIN...END rule is stupid
Alza
Posts: 4 Bronze 2
in SQL Prompt
Consider this temporary stored procedure code:
CREATE OR ALTER PROCEDURE #ST003_EXAMPLE AS BEGIN PRINT 'Great'; END; -- some debug after END... THROW 50000, 'Really!', 1; GO -- Separated statement for easy executing whole window from SSMS EXECUTE #ST003_EXAMPLE;
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.
Tagged:
Answers
Metricy
http://metricy.uk/
https://www.meetup.com/DataCardiff/