Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for a way to get all triggers and constraint we modified in a script to migrate them to a different database or reapply to this one if necessary. I'm using SQLServer Management Studio (2008R2) and want to script triggers and constraints from and to a 2008 instance. When I try to run the Script Wizard and select a table which was not modified, it works fine. However, I want to script out the tables where we modified triggers or constraints, and if I choose one of them, the Wizard just says Getting the list of objects from MyDatabase. - In progress and nothing more happens, it's just chattering away. Since it is working fine with unmodified tables, it has to be some issue with the modified tables. Does anyone know a way around this problem to get all modified triggers and constraints in a script? If the wizard can't do it, I'd be as happy with a T-SQL script^^ I know that I might get the create trigger commands from sys.all_sql_modules but I hesitate to use it as I don't know if this will cut long triggers or if it will get me the modified triggers as well.

Any help would be appreciated.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.