Sql server® 2012 t-sql fundamentals


-1d Run the following code in Connection 1 to roll back the transaction. ROLLBACK TRAN; 2-2



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

2-1d

Run the following code in Connection 1 to roll back the transaction.

ROLLBACK TRAN;

2-2

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



2-2a

Run the following code in Connection 1 to 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;

www.it-ebooks.info



330  

Microsoft SQL Server 2012 T-SQL Fundamentals



2-2b

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



Sales.OrderDetails. (Remember to uncomment the hint if you are running against SQL Database.)

SET TRANSACTION ISOLATION LEVEL READ COMMITTED; 

 

SELECT orderid, productid, unitprice, qty, discount 



FROM Sales.OrderDetails -- WITH (READCOMMITTEDLOCK) 

WHERE orderid = 10249;

Notice that you are now blocked.

2-2c

Run the following code in Connection 1 to commit the transaction.

COMMIT TRAN;

2-2d

Go to Connection 2 and notice that you get the modified, committed version of the rows.



2-2e

Run the following code for cleanup.

UPDATE Sales.OrderDetails 

  SET discount = 0.00 

WHERE orderid = 10249;

2-3

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



2-3a

Run the following code in Connection 1 to set the isolation level to REPEATABLE READ, open a trans-

action, and read data from Sales.OrderDetails.

SET TRANSACTION ISOLATION LEVEL REPEATABLE READ; 

 

BEGIN TRAN; 



 

  SELECT orderid, productid, unitprice, qty, discount 

  FROM Sales.OrderDetails 

  WHERE orderid = 10249;

You get two rows with discount values of 0.00.

www.it-ebooks.info





Download 10,93 Mb.

Do'stlaringiz bilan baham:
1   ...   360   361   362   363   364   365   366   367   ...   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