Change Script check if exists
EricLamontagne
Posts: 46 Bronze 3
Hello,
When generating a change script, there is no safeguard to check if the affected object already exists or not.
Is there an option I can set so it does a check before executing the change?
I understand I can add the check my self, but I'm kind of lazy you know
Eric
Tagged:
Best Answers
-
Sergio R Posts: 610 Rose Gold 5Hi,
In SQL Change Automation for SSMS, after you generate the script you can verify it, this verification will fail if you have duplicate objects.
There's also a drift check when you create a release using SQL Change Automation Powershell, which produces a drift report.Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools -
Sergio R Posts: 610 Rose Gold 5To complement my previous answer if you ensure that your targets are only updated from SQL Change Automation you shouldn't run into any issues.
There's also a Comparison option which adds existence checks if you generate the script by capturing it from the development database:<!-- "Add object existence checks" SQL Compare option -->
<SyncOptionIncludeExistenceChecks>False</SyncOptionIncludeExistenceChecks>Sergio
Product Support Engineer
Redgate Software Ltd
Please see our Help Center for detailed guides on how to use our tools
Answers
CREATE PROCEDURE $myproc$