BEGIN TRY
BEGIN TRANSACTION
// Code
COMMIT
END TRY
BEGIN CATCH
-- Whoops, there was an error
IF @@TRANCOUNT > 0
ROLLBACK
-- Raise an error with the details of the exception
DECLARE @ErrMsg nvarchar(4000), @ErrSeverity int, @Is_Error int
SELECT @ErrMsg = ERROR_MESSAGE(), @ErrSeverity = ERROR_SEVERITY(), @Is_Error =@@error
RAISERROR(@ErrMsg, @ErrSeverity, 1)
END CATCH
Saturday, January 2, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment