CREATE PROCEDURE proName
int
/*******************************************************
BEGIN
SET NOCOUNT
ON
BEGIN
TRY
BEGIN TRANSACTION transName
COMMIT TRANSACTION transName;
END
TRY
BEGIN
CATCH
ROLLBACK TRANSACTION transName;
DECLARE @ErrorMessage NVARCHAR(4000);
DECLARE @ErrorSeverity INT;
DECLARE @ErrorState INT;
SELECT
= ERROR_MESSAGE(),
@ErrorMessage
@ErrorSeverity
@ErrorState
= ERROR_SEVERITY (), = ERROR_STATE ();
RAISERROR (@ErrorMessage,
-- Message text.
@ErrorSeverity
,
-- Severity.
@ErrorState
-- State.
);
END
CATCH
SET NOCOUNT
OFF
Comments
*******************************************************/
AS
@param