Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Server lock matter when inserting many records

Author  Topic 

geossl
Yak Posting Veteran

85 Posts

Posted - 2004-09-02 : 05:37:23
Dear All,
When inserting a few to many records to a table, such as

- BeginTrans
- Insert into Tbl .....
......
- CommitTrans

SQL Server may try to escalate the lock to page (exclusive) even to table lock (exclusive). Instead of issuing a semaphore before insert, is there any better way to prevent such kind of contention problem?

Thanks.

raymondpeacock
Constraint Violating Yak Guru

367 Posts

Posted - 2004-09-02 : 05:59:15
SQL Server is trying to achieve the task in as fast a manner as possible by using the coarser locks. To try and override execute your INSERT with a locking hint.

INSERT into tbl .. (WITH ROWLOCK)
....



Raymond
Go to Top of Page
   

- Advertisement -