且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

SQL Server 2008 插入后运行触发器,更新锁定原始表

更新时间:2022-11-25 07:57:21

我在 Internet 上环顾四周,找不到任何方法可以在不要求锁定的情况下触发触发器.因此,我选择通过存储过程进行插入,然后执行之前在触发器中找到的逻辑.这使我能够在插入实际数据并解除插入锁之后在事务中执行触发器的内容.

I looked around on the internet, and I couldn't find any way of making the trigger happen without claiming a lock. Therefore I choose to do the inserts via a stored procedure, which in turn performs the logic previously found in the trigger. This allowed me to execute the content of the trigger in a transaction AFTER the actual data was inserted and the insertion lock was lifted.

希望这有帮助!