T-SQL Tutorial

T-SQL Error_procedure()


Return the procedure name of the error that use the CATCH block of a TRY ... CATCH.

Error_procedure() Syntax

ERROR_PROCEDURE();

Error_procedure() Example

CREATE PROCEDURE test_procedure
AS
   SELECT 3/0;
GO


USE model;
GO
BEGIN TRY
   EXECUTE test_procedure;
END TRY
BEGIN CATCH
   SELECT ERROR_PROCEDURE() AS Error_Procedure;
END CATCH;
GO

Error_Procedure
test_procedure

See also:
T-SQL Functions -> ERROR_STATE()