Command Line
tspeich
Posts: 14 Bronze 2
I am trying to package a script from the command line as part of an automated build process. I have created a project in Packager, that when run from the GUI works just fine and the result is a exe that will create a new database when run. When I run this same project from the command line via a cmd file, Packager still creates the package, but the resulting exe will only update an existing database. I only have 1 project created for packager, so I'm not mistakingly running the wrong one. :?:
Comments
The exe that is created as a result of running my project through SQL Packager, can be called from the command line with the switch /makedatabase. This will allow me to specify either to create or update no matter what the exe lets me do through the GUI. This still seems strange to me that the same project can have 2 different outcomes depending on where packager is called from. Maybe someone from Red Gate can give an explanation at their leisure. Until then I have my workaround. :lol:
I believe that you have answered your own question.
Once you have your executable package created by SQL Packager, when the package is run you can either upgrade an existing database or create a new database.
When you run the executable that SQL Packager has created it will bring a GUI and you specify the required options to make a new database or upgrade an existing database.
Running the same excutable with no options from the command line will also open the same GUI for the user to specify the options which include upgrading an existing database or making a new database.
If you run the executable from the command line and specify the server and database using the /server and /database switches the command line defaults to upgrading the database specified in the /database switch. To create a new database you need to use the /makedatabase switch and a new database will be created using the name specified by the /database switch.
I hope the above answers your question.
Many Thanks
Eddie
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com
Is it a viable workaround?
I agree that there are definite improvements we could make around creating databases whilst packaging, and we'll consider this in a future release.
David Atkinson
Red Gate Software
Product Manager
Redgate Software
I did just try to add a create db script that I use when testing the sync script that I get from SQLCompare. I still only get the option to upgrade, but I am able to choose the master table as my table to update and everything runs as I would like.
It wasn't the end of the world or anything, but is always nice to be able to get what you want.
Thanks for all your time David.