????--????????Ta
if not object_id('Ta') is null
drop table Ta
go
create table Ta(ID int Primary key??Col1 int??Col2 nvarchar(10))
insert Ta
select 1??101??'A' union all
select 2??102??'B' union all
select 3??103??'C'
go
????????????:
????/*
??????Ta
????ID Col1 Col2
????----------- ----------- ----------
????1 101 A
????2 102 B
????3 103 C (3 ???????) */
????1??????????????????:
????2????????????????????????
????3????????????????а汾????
????4?????????о?????????????????
????5???????????????????????
????????1(????):
????--???????
-----------------------???????1(update/insert/delete)------------------------------
begin tran
--update
update ta set col2='BB' where ID=2
--??insert
--begin tran
-- insert Ta values(4??104??'D')
--??delete
--begin tran
-- delete ta where ID=1
--rollback tran
-------------------------???????2????????---------------------------------------------
begin tran
select * from ta
--rollback tran
--- --????--------------------------------------------------
-->SQL SERVER 2005???????????
select
request_session_id as spid??
resource_type??
db_name(resource_database_id) as dbName??
resource_description??
resource_associated_entity_id??
request_mode as mode??
request_status as Status
from
sys.dm_tran_locks
--Result:
/*
????ID ??????? ????? ??????? ???????ID ?????? ??????
----------- ------------- ------ -------------------- ----------------------------- ----- ------
59 DATABASE Gepro 0 S GRANT
58 DATABASE Gepro 0 S GRANT
57 DATABASE Gepro 0 S GRANT
56 DATABASE Gepro 0 S GRANT
58 PAGE Gepro 1:1904 72057594039435264 IS GRANT
57 PAGE Gepro 1:1904 72057594039435264 IX GRANT
58 OBJECT              Gepro 853578079 IS GRANT
57 OBJECT Gepro 853578079 IX GRANT
57 KEY Gepro (020068e8b274) 72057594039435264     X      GRANT
58 KEY Gepro (020068e8b274) 72057594039435264 S      WAIT
(9 ???????)
*/