"Backup" [AdventureWorks] [dbo]. [uspPrintError]

Source: Internet
Author: User

Use [AdventureWorks]
GO

/****** object:storedprocedure [dbo]. [uspPrintError] Script date:04/10/2016 13:19:23 ******/
IF EXISTS (SELECT * from sys.objects WHERE object_id = object_id (N ' [dbo].[ uspPrintError] ') and type in (n ' P ', n ' PC '))
DROP PROCEDURE [dbo]. [uspPrintError]
GO

Use [AdventureWorks]
GO

/****** object:storedprocedure [dbo]. [uspPrintError] Script date:04/10/2016 13:19:23 ******/
SET ANSI_NULLS on
GO

SET QUOTED_IDENTIFIER ON
GO


--uspPrintError Prints error information about the error caused
--execution to the CATCH block of a TRY ... CATCH construct.
--should be executed from within the scope of a CATCH block otherwise
--It'll return without printing any error information.
CREATE PROCEDURE [dbo]. [uspPrintError]
As
BEGIN
SET NOCOUNT on;

--Print error information.
PRINT ' Error ' + CONVERT (varchar (), error_number ()) +
', Severity ' + CONVERT (varchar (5), error_severity ()) +
', state ' + CONVERT (varchar (5), error_state ()) +
', Procedure ' + ISNULL (error_procedure (), '-') +
', line ' + CONVERT (varchar (5), Error_line ());
PRINT error_message ();
END;

GO

EXEC sys.sp_addextendedproperty @name =n ' ms_description ', @value =n ' Prints error information about the error that caused ex Ecution to the CATCH block of a TRY ... CATCH construct. Should is executed from within the scope of a CATCH block otherwise it'll return without printing any error information. ', @level0type =n ' SCHEMA ', @level0name =n ' dbo ', @level1type =n ' PROCEDURE ', @level1name =n ' uspPrintError '
GO

"Backup" [AdventureWorks] [dbo]. [uspPrintError]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.