Sql server® 2012 t-sql fundamentals


-3d Go to Connection 2 and notice that the update has finished. 2-3e



Download 10,93 Mb.
Pdf ko'rish
bet366/443
Sana26.01.2022
Hajmi10,93 Mb.
#411755
1   ...   362   363   364   365   366   367   368   369   ...   443
Bog'liq
BookSQL

2-3d

Go to Connection 2 and notice that the update has finished.



2-3e

Run the following code for cleanup.

UPDATE Sales.OrderDetails 

  SET discount = 0.00 

WHERE orderid = 10249;

2-4

In this exercise, you will practice using the SERIALIZABLE isolation level.



2-4a

Run the following code in Connection 1 to set the isolation level to SERIALIZABLE and query 



Sales.OrderDetails.

SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; 

 

BEGIN TRAN; 



 

  SELECT orderid, productid, unitprice, qty, discount 

  FROM Sales.OrderDetails 

  WHERE orderid = 10249;

www.it-ebooks.info



332  

Microsoft SQL Server 2012 T-SQL Fundamentals



2-4b

Run the following code in Connection 2 to attempt to insert a row to Sales.OrderDetails with the same 

order ID that is filtered by the previous query and notice that you are blocked.

INSERT INTO Sales.OrderDetails 

    (orderid, productid, unitprice, qty, discount) 

  VALUES(10249, 2, 19.00, 10, 0.00);

Note that in lower isolation levels (such as READ UNCOMMITTEDREAD COMMITTED, or 

REPEATABLE READ), this INSERT statement wouldn’t have been blocked.

2-4c

Run the following code in Connection 1 to query Sales.OrderDetails again and commit the transaction.

  SELECT orderid, productid, unitprice, qty, discount 

  FROM Sales.OrderDetails 

  WHERE orderid = 10249; 

 

COMMIT TRAN;



You get the same result set that you got from the previous query in the same transaction, and 

because the INSERT statement was blocked, you get no phantom reads.



2-4d

Go back to Connection 2 and notice that the INSERT statement has finished.



2-4e

Run the following code for cleanup.

DELETE FROM Sales.OrderDetails 

WHERE orderid = 10249 

  AND productid = 2;

2-4f

Run the following code in both Connection 1 and Connection 2 to set the isolation level to the 

default.

SET TRANSACTION ISOLATION LEVEL READ COMMITTED;



2-5

In this exercise, you will practice using the SNAPSHOT isolation level.

www.it-ebooks.info




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   362   363   364   365   366   367   368   369   ...   443




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish