2012-03-02 66 views
0

以下觸發父ID的SQL Server

 
SELECT @parent = object_name(parent_id) from sys.triggers where name = 'tr1' 

將返回表名,但我不知道是否有可能返回它的對象ID?

我以爲object_id可以做到這一點,但返回null。

任何幫助將不勝感激。

回答

0

試試這樣說:

SELECT @parent = object_id(object_name(parent_id)) from sys.triggers where name = 'tr1' 
0

我想借此看看sys.triggers表documentation。由於這個,你可能會遇到問題?但是,我可能只是誤解了這個問題。

For DML triggers, this is the object_id of the table 
    or view on which the DML trigger is defined.