如果在删除设置 2我应该能够回滚设置1 交易为well.Let我知道,如果我们 有任何选项来执行这样出现任何错误。 感谢您的帮助。
那么,你为什么不这样做呢?
BEGIN TRY
BEGIN TRANSACTION -- Start the transaction
DELETE SET 1(this will delete first set of table)
DELETE SET 2 (will delete second set of table)
-- If we reach here, success!
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
SELECT @ErrMsg = ERROR_MESSAGE(),
@ErrSeverity = ERROR_SEVERITY()
RAISERROR(@ErrMsg, @ErrSeverity, 1)
END CATCH
阅读here的完整说明。
DDL(DROP/CREATE)*是*交易安全...如果您曾经使用过红门SQL比较,您会看到它 – gbn 2010-05-22 15:47:35