开发者

Lock at the time of Inserting record

开发者 https://www.devze.com 2023-02-15 04:17 出处:网络
I have windows service have two method which are inserting data to the same table at the same time.but at the time of insert it threw the exception.how i can make lock on such situation.

I have windows service have two method which are inserting data to the same table at the same time.but at the time of insert it threw the exception.how i can make lock on such situation.

t开发者_如何学Chank you in advance


if its update statement, i would suggest BEGIN TRANSACTION with READ COMMIITED isolation level. but since its insert, u might want to create extra table act like a queue. Insert everything in new table and after that u can run your validation.

0

精彩评论

暂无评论...
验证码 换一张
取 消