"USE" clause in creation statements
ergoface
Posts: 6 Bronze 1
I know there is an option in SQL Compare to include 'USE <database>' statements when generating code. I have tried selecting this in the comparison options, but when the various table, view, stored procedure, code is generated in SQL Source control I can't get it to generate USE statement at the top.
I really need this both for our local coding standards and because if I have to run any of these generated scripts separately I will have to add it to ensure it runs properly.
I know that if I create a deployment using SQL Compare it will (with the option selected) add a USE statement at the top of the deployment script, but I need it in the individual creation scripts that are getting committed to source control.
I've looked, but don't see any other options that address this.
Thanks,
Dave Bennett
I really need this both for our local coding standards and because if I have to run any of these generated scripts separately I will have to add it to ensure it runs properly.
I know that if I create a deployment using SQL Compare it will (with the option selected) add a USE statement at the top of the deployment script, but I need it in the individual creation scripts that are getting committed to source control.
I've looked, but don't see any other options that address this.
Thanks,
Dave Bennett
Dave Bennett
Comments
Thanks for your question on SQL Source Control and comparison options. We do have the same option available. If you click a DB that is source controlled, go to the setup tab, scroll down to the section "Options just for this database", the click on "Comparison options". The one you're looking for should be at the top.
Red Gate Software
US Product Support
Looking at the option I had thought it would work the way you suggest, but it didn't.
If you can show that it does work, what might I be doing wrong that it won't generate properly?
Thanks
Dave