How to Find triggers associated with a TABLE(Physical file) in AS400 (IBMi Power System) using SQL

Well you can use DSPFD but how about just query the view SYSTRIGGER

SELECT SUBSTR(TABSCHEMA,1,10) AS LIBRARY,                   
             SUBSTR(TABNAME,1,10) AS TABLE,                 
             TRIGTIME AS TRIGGER_TIME,                      
             CREATE_DTS AS CREATED,                         
             SUBSTR(TRIGPGM,1,10) AS TRIGGER_PROGRAM,       
             SUBSTR(TRIGPGMLIB,1,10) AS PROGRAM_LIBRARY,    
             OPERATIVE,                                     
             ENABLED,                                       
             SUBSTR(DEFINER,1,10) AS CREATE_USER,           
             EVENT_U AS ON_UPDATE,                          
             EVENT_I AS ON_INSERT,                          
             EVENT_D AS ON_DELETE,                          
             TRIGNAME AS TRIGGER_NAME                       
       FROM QSYS2/SYSTRIGGER                                
       WHERE TABSCHEMA = 'MYLIB'                            
           and TABNAME = 'MYTABLE'                          

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.