New answers tagged


You are missing the error handling piece (i.e. TRY...CATCH). Please see the Stored Procedure template that I posted in the following DBA.StackExchange answer: Are we required to handle Transaction in C# Code as well as in Store procedure


Is there a more terse way of returning an error message and returning control to the caller for unwanted situations that aren't strictly speaking errors? You can use THROW Raises an exception and transfers execution to a CATCH block of a TRY…CATCH construct ... If a TRY…CATCH construct is not available, the session is ended. IF @UserName = '...

Top 50 recent answers are included