2014-11-06 176 views
0

我在哪裏可以找到構建在數據庫上的觸發器的位置,我在Google上搜索過,但無法獲得任何結果。SQL server 2008 r2觸發位置

我的觸發腳本是:

CREATE TRIGGER [log] 
ON DATABASE 
FOR DDL_DATABASE_LEVEL_EVENTS 
AS 
DECLARE @data XML 
SET @data = EVENTDATA() 
.... 
.... 
+0

你說的*觸發器的位置意味着*? – 2014-11-06 08:14:21

+0

如果你的意思是,我在哪裏可以找到SSMS的「對象瀏覽器」上的Tigger? – Mithrandir 2014-11-06 08:18:36

+0

是的,我的意思是。 – Ibra 2014-11-06 09:28:56

回答

0

這張圖片是有幫助............

enter image description here

+0

Ahhh這是感謝 – Ibra 2014-11-06 11:28:56

0

要一一列舉:

SELECT 
    sysobjects.name AS trigger_name 
    ,USER_NAME(sysobjects.uid) AS trigger_owner 
    ,s.name AS table_schema 
    ,OBJECT_NAME(parent_obj) AS table_name 
    ,OBJECTPROPERTY(id, 'ExecIsUpdateTrigger') AS isupdate 
    ,OBJECTPROPERTY(id, 'ExecIsDeleteTrigger') AS isdelete 
    ,OBJECTPROPERTY(id, 'ExecIsInsertTrigger') AS isinsert 
    ,OBJECTPROPERTY(id, 'ExecIsAfterTrigger') AS isafter 
    ,OBJECTPROPERTY(id, 'ExecIsInsteadOfTrigger') AS isinsteadof 
    ,OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled] 
FROM sysobjects 

INNER JOIN sysusers 
    ON sysobjects.uid = sysusers.uid 

INNER JOIN sys.tables t 
    ON sysobjects.parent_obj = t.object_id 

INNER JOIN sys.schemas s 
    ON t.schema_id = s.schema_id 

WHERE sysobjects.type = 'TR' 

來源:Need to list all triggers in SQL Server database with table name and table's schema

要查看他們:

enter image description here

來源:Can't see the triggers that i created in sql server management studio 2008

+0

不,我知道我在哪裏可以找到建立在表上的觸發器,但是我不知道在數據庫上建立的觸發器的位置(在對象瀏覽器上) – Ibra 2014-11-06 09:32:35

+0

在觸發器文件夾下,如上圖所示? – Matt 2014-11-06 09:33:30

+0

沒有不喜歡的圖片 – Ibra 2014-11-06 09:34:18