Throw raises an error of severity 16.
When either of throw or raise error > 10 is encountered in try block, then execution goes to the catch block.
However, if I don’t have try/catch block, then throw seems to exit the program whereas raiserror is just like any error (example: select 1/0) and it doesn’t stop the execution.
<code>Print 1;
;throw 5000,'test',1;
Print 2;
</code>
<code>Print 1;
;throw 5000,'test',1;
Print 2;
</code>
Print 1;
;throw 5000,'test',1;
Print 2;
Another example:
<code>Print 1;
Raiserror('test',16,1);
Print 2;
</code>
<code>Print 1;
Raiserror('test',16,1);
Print 2;
</code>
Print 1;
Raiserror('test',16,1);
Print 2;
Can we say that without using try/catch block, if we want to exit a program (for example say IF @VARVLAUE=100), then throw is the correct way to stop execution?