CREATE PROCEDURE dbo.usp_PrintError
AS
BEGIN
    PRINT 'Error ' + CONVERT(nvarchar(12), ERROR_NUMBER()) +
          ', Severity ' + CONVERT(nvarchar(5), ERROR_SEVERITY()) +
          ', State ' + CONVERT(nvarchar(5), ERROR_STATE()) +
          ', Procedure ' + ISNULL(ERROR_PROCEDURE(), '-') +
          ', Line ' + CONVERT(nvarchar(5), ERROR_LINE());
    PRINT ERROR_MESSAGE();
END 
GO