If I do the following query
spFoo throws an error, it still executes the print statement.
However if I do
It behaves as I expected and does not continue after an error.
Could someone please explain this behaviour for me? It still continues on even if I encapsulate it in a transaction. It is not just the with a print-statement but also with any other thing. My initial thought was that it was a severity problem but the severity was level 16. Is this normal T-SQL behaviour? If so, what motivates this design that contradicts every other language I have ever worked with that directly escalates the error?
I have tried and seen the same behaviour in SQL Server 2012, 2014 and 2017 across several different machines. The stored procedure in question is linked to a SQL CLR.