Applied from SQL Server 2005
BEGIN TRY
BEGIN TRAN
--Your T-SQL code here
COMMIT TRAN
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
SELECT @ErrorMessage = ERROR_MESSAGE();
ROLLBACK TRAN;
RAISERROR(@ErrorMessage, 16, 1);
END CATCH
Applied from SQL Server 2005
BEGIN TRY
BEGIN TRAN
--Your T-SQL code here
COMMIT TRAN
END TRY
BEGIN CATCH
DECLARE @ErrorMessage NVARCHAR(4000);
SELECT @ErrorMessage = ERROR_MESSAGE();
ROLLBACK TRAN;
RAISERROR(@ErrorMessage, 16, 1);
END CATCH
at 12:11 AM
Labels: SQL Server 2005, SQL Server 2008, SQL Server Tip
No comments:
Post a Comment