When using SQL Server Management Studio, generate scripts without setting protection around triggers

I see an interesting difference in behavior between my instance and my SSMS boss instance. When he uses Tasks-> Generate Scripts ... for tables, he puts guards around triggers for this table (if exists ...), but when I do the same using the same options, SSMS does not put guards around triggers. so I get errors if I run a script that is generated more than once. Any idea how I can get SSMS to create guards around triggers for me?

+3
source share
3 answers

In SSMS, review the Tools / Options dialog box (menu) in the Scripting section. The “Enable IF NOT EXISTS clause” option may vary between your two systems, but there may be something similar, but more obscure.

+6
source

In SSMS, select "Tools", "Parameters", "SQL Server Object Browser", "Script Parameters", "Object Script Parameters", "Enable IF NOT EXISTS Condition". Your boss can be set to true, your false.

+5
source

", " "" Script "" ""? "False".

+3

Source: https://habr.com/ru/post/1762461/


All Articles