SQL Server?????????-???????
???????????? ???????[ 2015/2/26 16:05:00 ] ????????????? SQL Server ???????
???????:SQL2012?з?????????????????????????????????????????????????????.????SQL2008R2??δ???????????????????????????????????????SQL Server????????????????????????-???????
???????????:??????????????????SQL Server(????汾)??????Щ???ν????????????????????????????????????????????.
??????????????????????????SQL2008R2?п?????update????м?????1-1
????Code ???????????
create table testlock
(ID varchar(10) primary key clustered??
col1 varchar(20)??
col2 char(200))
go----------create test table
declare @i int
set @i = 1
while @i < 100
begin
insert into testlock
select right(replicate('0'??10)+ cast(@i as varchar(10))??10)??'aaa'??'fixchar'
set @i = @i+1
end
go----------generate test data
????Code ???????
declare @ID nvarchar(10)
begin tran
select top 1 @ID = ID from testlock with(updlock?? rowlock?? readpast)
where col1 = 'aaa'
order by id asc
select @ID
waitfor delay '00:00:20'
update testlock set col1 = 'bbb' where id = @ID
commit tran
????
?1-1
??????????????SQL Server??????@ID???????????????????????????????д?????????????????????????Ч????????????????????????????????????????.
??????????????
????????ж????????????????????????????????CPU??IO???????????0????????????????С?仯?????????м???????????????????????估?????????????????????????м???.???1-2
????
?1-2
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11