Сделана 10 лаба

This commit is contained in:
2022-10-26 04:27:12 +03:00
parent c96fca8bc7
commit b4cf7ebb8c
5 changed files with 81 additions and 0 deletions

21
Lab10/Task2.sql Normal file
View File

@@ -0,0 +1,21 @@
/*
Starts a transaction to read the record of
Dominic Gonzalez and update his first name.
Second SELECT shows the uncommitted update.
@@trancount showS the number of open transactions.
Then the transaction is rolled back and the record read again.
*/
USE AdventureWorks
BEGIN TRANSACTION
SELECT @@trancount AS 'Transaction Count'
SELECT FirstName, MiddleName, LastName FROM Person.Contact WHERE ContactID = 7454
UPDATE Person.Contact SET FirstName = 'Dom' WHERE ContactID = 7454
SELECT FirstName, MiddleName, LastName FROM Person.Contact WHERE ContactID = 7454
SELECT @@trancount AS 'Transaction Count'
-- END TRANSACTION HERE
ROLLBACK TRANSACTION
SELECT FirstName, MiddleName, LastName FROM Person.Contact WHERE ContactID = 7454
SELECT @@trancount AS 'Transaction Count'