??????????????
????????д???????????·?????????????????????????????????????????????????????????????????????????ü???????????????????
??????????壺??????????????????£???????????????????????????
???????????????????????????????????????????л?????????????????????????????????????????????????????洢???????????????????????????????????????????????????????в?????????????????????????????????????????????????????????????
???????????????
????????????????????????ü??仰????????????????????????????????????Щ???
????????????????????????????????????????????????????????????????????????????????????????09?????????????????????????????????????????????????
??????????????????PPT?????????????????ЩPPT????????????????????????
????????????????
?????????????????????????????????????????????????????дSQL?????????????????????????
?????????????????????????????????????e?????????????????
SELECT * FROM AppLog WITH (HOLDLOCK) /*??????*/
SELECT * FROM AppLog WITH (UPDLOCK)  /*??????*/
SELECT * FROM AppLog WITH (XLOCK) WHERE LogID='AA599A4E-B727-4A65-8010-00001661765E'; /*??????*/
SELECT * FROM AppLog WITH (ROWLOCK) WHERE LogID='6BE2C680-0C9F-43FA-9B4E-00000A6C1CEF'; /*????*/
SELECT * FROM AppLog WITH (TABLOCKX) /*????????????*/
SELECT * FROM AppLog WITH (XLOCK??ROWLOCK) WHERE LogID='AA599A4E-B727-4A65-8010-00001661765E'; /*??????????*/
/*XLOCK ??????????????е??TABLOCKX??????????*/
SELECT * FROM AppLog WITH (NOLOCK)   /*???????????????????????????????*/
SELECT * FROM AppLog WITH (READPAST)  /*????????????????????????????*/
????????????????
????????????????????????????????
???????1??
????BEGIN TRAN
????SELECT * FROM AppLog WHERE LogID  = 'A10BA165-6E52-4AFB-9EA8-000000D6B90A';
????UPDATE AppLog SET AppPostion = AppPostion + AppPostion WHERE LogID = 'A10BA165-6E52-4AFB-9EA8-000000D6B90A';
???????2??
????BEGIN TRAN
????SELECT * FROM AppLog WHERE LogID  = 'A10BA165-6E52-4AFB-9EA8-000000D6B90A';
????UPDATE AppLog SET AppPostion = AppPostion + AppPostion WHERE LogID = 'A10BA165-6E52-4AFB-9EA8-000000D6B90A';
???????????1?????2????? SELECT?????1??????????????????2?????????????????????1 SELECT ?????????????UPDATE???????????????????1????????????
????????????????????н???????UPDATE.
????????????????????????????????????????????????????????????е?????????????????????2????????????????????1??(?????2?????????????????????????????????????????????1????????????????????2????????????????
?????壺???????????
???????????????????????????????????
CREATE TABLE a
(
id INT ??
name NVARCHAR(20)
)
BEGIN TRAN
INSERT a VALUES ('1'??'a')--????????????????????????????insert ???????????????????????
???????????????????У?
????select COUNT(*) from a with(nolock)--?????????????????1
????select COUNT(*) from a with(readpast)--??????????????????????0
??????????select * from a –?????鯔???????????????????????????????δ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ?????????????????????????δ???????μ??????????????????????????????????????