0

Where can i find the location of triggers that built on database, I had search on Google but i couldn't get any result.

My trigger script is :

CREATE TRIGGER [log]
ON DATABASE
FOR DDL_DATABASE_LEVEL_EVENTS 
AS
DECLARE @data XML
SET @data = EVENTDATA()
....
....
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Ibra
  • 192
  • 11

2 Answers2

0

To list them:

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' 

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

To view them:

enter image description here

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

Community
  • 1
  • 1
Matt
  • 14,906
  • 27
  • 99
  • 149
  • No, I know where i can find a trigger built on table, but i don't know the location ( on object explorer) of trigger that built on Database – Ibra Nov 06 '14 at 09:32
  • Under the triggers folder as in the image above? – Matt Nov 06 '14 at 09:33
  • Do you mean in the right click menu and then location object option? – Matt Nov 06 '14 at 09:37
  • If you right click on the trigger (or a function for that matter) you can choose locate object – Matt Nov 06 '14 at 09:42
  • :) How can I Right click on the trigger if I cant find it in the object explorer ! – Ibra Nov 06 '14 at 09:48
  • The location is in the image above... Databases > System Databases > (YourDbName) > Tables > (YourTableName) > Triggers > (YourTriggerName) – Matt Nov 06 '14 at 09:49
0

Is this picture helpful............

enter image description here

Roy Liu
  • 51
  • 3