TTT
TTT

Reputation: 1885

Can I disable/enable a trigger based on object_id, or without using its name?

Is there a way to write something like

DISABLE TRIGGER WHERE object_id = x

or another way not to hardcode the trigger's name?

Upvotes: 1

Views: 45

Answers (1)

sepupic
sepupic

Reputation: 8697

declare @obj sysname = object_name(xxx);
declare @sql varchar(4000) = 'disable trigger ' + @obj
exec(@sql) 

?

Upvotes: 3

Related Questions