Sql server® 2012 t-sql fundamentals



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

 

CHAPTER 9

 

Transactions and Concurrency



 

 333

2-5a

If you’re doing the exercises against an on-premises SQL Server instance, run the following code to 

set the SNAPSHOT isolation level in the TSQL2012 database (enabled in SQL Database by default):

ALTER DATABASE TSQL2012 SET ALLOW_SNAPSHOT_ISOLATION ON;



2-5b

Run the following code in Connection 1 to open a transaction, update rows in Sales.OrderDetails, and 

query it.

BEGIN TRAN; 

 

  UPDATE Sales.OrderDetails 



    SET discount += 0.05 

  WHERE orderid = 10249; 

 

  SELECT orderid, productid, unitprice, qty, discount 



  FROM Sales.OrderDetails 

  WHERE orderid = 10249;



2-5c

Run the following code in Connection 2 to set the isolation level to SNAPSHOT and query 



Sales.OrderDetails. Notice that you’re not blocked—instead, you get an earlier, consistent ver-

sion of the data that was available when the transaction started (with discount values of 0.00).

SET TRANSACTION ISOLATION LEVEL SNAPSHOT; 

 

BEGIN TRAN; 



 

  SELECT orderid, productid, unitprice, qty, discount 

  FROM Sales.OrderDetails 

  WHERE orderid = 10249;




Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   363   364   365   366   367   368   369   370   ...   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