MS SQL Server 2014: which stored procedure is my error in? As a general question or three on Microsoft SQL Server 2014, that perhaps I should know the answer to already, or even perhaps did once -
When my stored procedures run other stored procedures, how can I find out which stored procedure's code generated the error?
Is there a particular way to handle errors from Transact-SQL that identifies the location of the error in a given stored procedure?
Can program code in a stored procedure obtain the name of the procedure it is in?
I am prepared to put &quot;SET @MyNameIs = N'HastilyWrittenProcedure' &quot; in program code if it's the only way.  Then I can put &quot;PRINT @MyNameIs + ' broke.' &quot; in the error handler in everything.
Use @@procid to get the currently executing routine and object_name() to convert the id to a name
Hth