0
SELECT @parent = object_name(parent_id) from sys.triggers where name = 'tr1'
将返回表名,但我不知道是否有可能返回它的对象ID?
我以为object_id可以做到这一点,但返回null。
任何帮助将不胜感激。
SELECT @parent = object_name(parent_id) from sys.triggers where name = 'tr1'
将返回表名,但我不知道是否有可能返回它的对象ID?
我以为object_id可以做到这一点,但返回null。
任何帮助将不胜感激。
试试这样说:
SELECT @parent = object_id(object_name(parent_id)) from sys.triggers where name = 'tr1'
我想借此看看sys.triggers表documentation。由于这个,你可能会遇到问题?但是,我可能只是误解了这个问题。
For DML triggers, this is the object_id of the table
or view on which the DML trigger is defined.