我运行了这个 SQL:
create table temp
(
id int,
name varchar(10)
)
insert into temp values(1,'a');
然后我运行,
select 1 from temp where id = 1
一切正常。
然后我运行了一个未提交的插入操作,
SET NOCOUNT ON;
DECLARE @TranCount INT;
SET @TranCount = @@TRANCOUNT;
IF @TranCount = 0
BEGIN TRANSACTION
ELSE
SAVE TRANSACTION Insertorupdatedevicecatalog;
insert into temp values(2,'b')
然后我运行,
select 1 from temp where id = 1
但这次没有返回任何内容。为什么我的整个表格被锁定了,而不仅仅是第二行?