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

后端 未结 19 927
再見小時候
再見小時候 2020-11-28 17:12

I need to list all triggers in SQL Server database with table name and table\'s schema.

I\'m almost there with this:

SELECT trigger_name = name, trig         


        
19条回答
  •  攒了一身酷
    2020-11-28 18:14

    this may help.

    SELECT DISTINCT o.[name] AS [Table]
    FROM    [sysobjects] o
    JOIN    [sysobjects] tr
        ON  o.[id] = tr.[parent_obj]
    WHERE   tr.[type] = 'tr'
    ORDER BY [Table]
    
    Get a list of tables and all their triggers.
    
    SELECT DISTINCT o.[name] AS [Table], tr.[name] AS [Trigger]
    FROM    [sysobjects] o
    JOIN    [sysobjects] tr
        ON  o.[id] = tr.[parent_obj]
    WHERE   tr.[type] = 'tr'
    ORDER BY [Table], [Trigger]
    

提交回复
热议问题