SQL Packager 7

Package created from script always creates new database


Note: This problem is fixed in version 6.2

When running a SQL Package executable from the command line, a new database is always created regardless of whether or not the /makedatabase switch is specified. This happens only when the package had been created by packaging an existing SQL script file.

Cause

There is a bug in the SQL Packager code template that will cause the package to create a database whenever the saved package properties specify a new database package, and the command-line arguments do not override this. Packaging a script always behaves as if a new database will be created.

How to fix

As a workaround, the "SQL Packager Code Templates" files can be modified so that the presence command-line /makedatabase switch will override the database creation setting saved into the package. To do this:

  1. Use Windows Explorer to browse to %programfiles%\red gate\sql packager 6\SQL Packager Code templates\C#
  2. Open PackageExecutor.cs using Notepad
  3. From the Edit menu, choose Go To and go to line 421
  4. Open a new line above the line beginning with "m_MakeDatabase = "
  5. Insert the following text in the new line:
 if (!PackageUtils.ConsoleMode)


All SQL Packager projects created after this modification will that are run from the command prompt will only create a new database when the /makedatabase switch is used.

 


Didn't find what you were looking for?