开发者

When using SQL server management studio generate scripts, not putting guard around triggers

开发者 https://www.devze.com 2023-01-14 19:02 出处:网络
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 trigger

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号