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/Lab10/Task1.sql
2022-10-26 04:27:12 +03:00

19 lines
615 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'