sqlsybasesap-ase

Looking for a sql command to find active triggers, and their associated tables


I am trying to find active triggers and their associated tables in Sybase. What would be a written query?

I found the following SQL command useful select * from sysobjects where type = "TR" where deltrig =1 or instrig = 1 or updtrig =1

But, I do not know how to associate the trigger name with the name of a table.


Solution

  • I found the answere after 1 year coming back to this question

    SELECT 
        triggers.name AS trigger_name,
        tables.name AS table_name
    FROM 
        sysobjects AS triggers
    JOIN 
        sysobjects AS tables 
        ON triggers.id = tables.deltrig 
           OR triggers.id = tables.instrig 
           OR triggers.id = tables.updtrig
    WHERE 
        triggers.type = "TR"  -- Only triggers
        AND tables.type = "U" -- Only user tables
    ORDER BY 
        tables.name, triggers.name;