我使用“WITH (TABLOCK)”语句在一个空的聚集表中进行插入,以最小化事务日志记录:INSERT INTO myTable WITH (TABLOCK) (Column1, Column2...) SELECT X, Y from Z
TABLOCK 获取共享锁,而 TABLOCKX 获取排它锁。 以下是两者的示例: select * from yourtableSharedLock with (tablock) select * from yourtableExclusiveLock with (tablockx)