Red Gate forums :: View topic - Command Line
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Packager 6
SQL Packager 6 forum

Command Line

Search in SQL Packager 6 forum
Post new topic   Reply to topic
Jump to:  
Author Message
tspeich



Joined: 04 May 2010
Posts: 10

PostPosted: Tue May 04, 2010 5:47 pm    Post subject: Command Line Reply with quote

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. Question
Back to top
View user's profile Send private message
tspeich



Joined: 04 May 2010
Posts: 10

PostPosted: Tue May 04, 2010 8:50 pm    Post subject: Reply with quote

I have found a work around at least.
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. Laughing
Back to top
View user's profile Send private message
eddie davis



Joined: 14 Jun 2006
Posts: 939
Location: Red Gate Software

PostPosted: Thu May 06, 2010 3:30 pm    Post subject: Reply with quote

Thank you for your post into the forum.

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
_________________
Eddie Davis
Technical Support Engineer
Red Gate Software Ltd
E-mail: support@red-gate.com
Back to top
View user's profile Send private message Send e-mail
tspeich



Joined: 04 May 2010
Posts: 10

PostPosted: Thu May 06, 2010 3:57 pm    Post subject: Reply with quote

The exe that is created(when packager is run from cmd) will not create a new database, unless I run it from the command Line. The desired result, would be an exe that is packaged by calling packager from the command line, and will create a new database without having to be run from the command line. When I open the exe's GUI there is no option for create or upgrade, upgrade is the only option available. The exe that is created when I run packager from the GUI does have the option of upgrading or creating. The exe that is created by sql packager, is not the same exe depending on where I called packager from.
Back to top
View user's profile Send private message
David Atkinson



Joined: 05 Dec 2005
Posts: 1123
Location: Twitter: @dtabase

PostPosted: Thu May 06, 2010 6:09 pm    Post subject: Reply with quote

I haven't tried this myself, but it might be possible to go through the Packager wizard and save the script, rather than creating the executable. You could edit this and add the CREATE DATABASE statement at the top. Run through the wizard again and package up the script you've modified.

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
Back to top
View user's profile Send private message Send e-mail
tspeich



Joined: 04 May 2010
Posts: 10

PostPosted: Thu May 06, 2010 7:52 pm    Post subject: Reply with quote

The projcect that I run in SQLPackager is a script created by SQLCompare after comparing a scripts folder of objects(all create scripts) against an empty database. Therefore what I'm packaging is already a big create script.

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. Surprised

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group