Skip to main content

Posts

Showing posts with the label SQL trigger

Listing All Triggers in the SQL Server Database

 /*********************************************************************************/ /* Listing All Triggers in the SQL Server - SQL Server Tutorial */ /* Need to list all triggers in SQL Server database with table */ /* List triggers in SQL Server database - SQL Server Data */ /*********************************************************************************/ /*********************************************************************************/    /*Example 1*/ /*********************************************************************************/ SELECT    ServerName   = @@servername,    DatabaseName = db_name(),    SchemaName   = isnull( s.name, '' ),    TableName    = isnull( o.name, 'DDL Trigger' ),    TriggerName  = t.name,     Defininion   = object_definition( t.object_id ) FROM sys.triggers t    LEFT JOIN sys.all_objects o       ON t.pare...

find all trigger associated with SQL Table

Need to list all triggers in SQL Server database with table name and table's schema How To Find List All Triggers in SQL Server? The below T-SQL Query will help us to get the results: Example 1: To list all triggers in a SQL Server, you query data from the sys.triggers view:   SELECT      name,     is_instead_of_trigger     FROM      sys.triggers   WHERE        type = 'TR';   Example 2: select trg . name as trigger_name ,     schema_name ( tab . schema_id ) + '.' + tab . name as [table] ,     case                               when is_instead_of_trigger = 1                     ...