How to Generate Scripts For All Triggers in Database Using Microsoft SQL Server Management Studio

前端 未结 5 924
小蘑菇
小蘑菇 2020-12-05 03:51

I\'d like to generate an SQL Script that contains the SQL to create all of the triggers that exist in our database. The triggers were added directly via the SSMS query pane

5条回答
  •  有刺的猬
    2020-12-05 04:32

    How about this?

    select text from syscomments where text like '%CREATE TRIGGER%'

    EDIT - per jj's comment below, syscomments is deprecated and will be removed in the future. Please use either the wizard-based or script-based solutions listed above moving forward :)

提交回复
热议问题