垃圾事务

USE AdventureWorks;
GO
BEGIN TRANSACTION;
GO
UPDATE Person.Contact
    SET LastName = '1111'
    WHERE LastName = 'Wood';
GO
IF @@TRANCOUNT > 0
BEGIN
    PRINT N'A transaction needs to be rolled back.';
    ROLLBACK TRANSACTION;
END
select LastName  from Person.Contact  WHERE LastName = 'Wood';

你可能感兴趣的:(事务)