如何在使用LinqToSQL时关闭触发器 [英] How to turn off triggers while using LinqToSQL
问题描述
我有带有更新触发器的DB表(用于跟踪更改的历史记录)。我想使用LinqToSql在该表上进行较大的更改。但是要快速完成,我必须:关闭触发器,进行更改,然后再打开触发器。
是否可以使用LinqToSql启用/禁用触发器?
I have DB table with update trigger (to track history of changes). I want to use LinqToSql to do large changes on that table. But to do that fast I have to: turn off trigger, make changes and turn on trigger.
Is there any way to enable/disable triggers using LinqToSql?
推荐答案
,您将必须使用 msdn文档
禁用触发器{[schema_name。 ] trigger_name [,... n] | ALL}
ON {object_name |数据库|所有服务器} [; ]
DISABLE TRIGGER { [ schema_name . ] trigger_name [ ,...n ] | ALL } ON { object_name | DATABASE | ALL SERVER } [ ; ]
另请参见这个问题关于如何通过DataContext执行上述语法(或任何sql)
see also this question on how to execute the above syntax (or any sql) via the DataContext
这篇关于如何在使用LinqToSQL时关闭触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!