Lets say I have a stored procedure which has a simple IF block. If the performed check meets the criteria, then I want to stop the procedure from further execution.
What is the best way to do this?
Here is the code:
IF EXISTS (<Preform your Check>)
BEGIN
// NEED TO STOP STORED PROCEDURE EXECUTION
END
ELSE
BEGIN
INSERT ()...
END
Thanks for any help with this!
Just make a call to RETURN:
This will return the control back to the caller immediately – it skips everything else in the proc.