I'm seeing an interesting behavior difference between my instance and my boss's instance of SSMS. When he uses Tasks->Generate Scripts... for tables, it puts gua开发者_高级运维rds around the triggers for that table (If exists...) but when I do the same thing using the same options SSMS doesn't put the guards around the triggers so I get errors if I run the script it generates more than once. Any idea how I can get SSMS to generate the guards around the triggers for me?
In SSMS, review the (menu) Tools / Options dialog, in the "Scripting" section. The setting of "Include IF NOT EXISTS clause" may differ between your two systems, but it may be something similar but more obscure.
In SSMS, click Tools, Options, SQL Server Object Explorer, Scripting, Object Scripting Options, Include IF NOT EXISTS clause. Your boss may have it set to true, yours false.
Did you set the "Include If NOT EXISTS" option on the Choose Script Options page to "True"? It is "False" by default.
精彩评论