

USE AdventureWorks
-- Update two vendors to have a ActiveFlag of false
-- Update Vendor contact for each of those vendors to have a ContactTypeID of 'owner'
GO



-- Execute the BEGIN TRAN and the first UPDATE 
BEGIN TRAN
  UPDATE NewVendor 
  SET ActiveFlag = 'False'
  WHERE VendorID = 1

-------- Only execute up to this point in the first batch ----
--------------------------------------------------------------
-------  Next, start execution here ----------------------
  UPDATE NewVendorContact 
  SET ContactTypeID = (SELECT ContactTypeID FROM Person.ContactType
						WHERE Name = 'Owner')
  WHERE VendorID = 1

-------- Only execute up to this point in the next batch ------
--------------------------------------------------------------
ROLLBACK TRAN




-- --The following transaction will be executed on another connection
--BEGIN TRAN
--  UPDATE NewVendorContact 
--  SET ContactTypeID = (SELECT ContactTypeID FROM ContactType
--						WHERE Name = 'Owner')
--  WHERE VendorID = 15 

--  UPDATE NewVendor 
--  SET ActiveFlag = 'False'
--  WHERE VendorID = 15

--COMMIT TRAN
