Finding triggers and stored procedures from systables

  • I need more help navigating the system tables.  Can anyone tell me how to find the triggers and the trigger code attached to a table?  I also need to find the user stored procedures and code in the db.

    TIA

  • You may want to check out  sp_helptext on books online

     

    Michael

  • For Trigger:

    SELECT OBJECT_NAME(a.[ID]) TriggerName, b.[Text] TriggerCode FROM SysObjects a INNER JOIN SysComments b ON a.[ID] = b.[ID]

    WHERE a.Type = 'TR'

    For Procedure:

    replace the Type with 'P'

    You can also find the Procedure and Function details from the information_schema.routines view

     


    bm21

  • That is great. 

    Thanks very much.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply