This repository has been archived on 2024-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
Databases/Скрипты и задания/Tran1.sql

21 lines
617 B
SQL

/*
Starts a transaction to read the record of
Linda Gonzales and update her first name.
Second select shows the uncommitted update.
@@trancount shows the number of open transactions.
*/
USE AdventureWorks
-- START TRANSACTION HERE
BEGIN TRANSACTION
SELECT @@trancount AS 'Transaction Count'
SELECT FirstName, MiddleName, LastName FROM Person.Contact WHERE ContactID = 342
UPDATE Person.Contact SET FirstName = 'Lin' WHERE ContactID = 342
-- END TRANSACTION HERE
COMMIT TRANSACTION
SELECT FirstName, MiddleName, LastName FROM Person.Contact WHERE ContactID = 342
SELECT @@trancount AS 'Transaction Count'