Creating EXE with multiple scripts and custom commandline

Packages and compresses schema and contents of SQL Server databases

Moderators: JonathanWatts, Chris Auckland, David Atkinson, david connell, Anu Deshpande, Michelle Taylor, james.billings, Marianne

Creating EXE with multiple scripts and custom commandline

Postby Tadul » Fri Feb 08, 2013 7:20 am

Can i supply more than one SQL scripts (.SQL files) and generate an exe with custom commandline?

for ex. i have a .bat file to be run passing certain command line parameters.This batch file calls many .sql files and update databse etc.so can i create an exe which runs all required like mentioned above by batch file.I want to pass custom arguments which i will take it from registry.

Please Help
Tadul
 
Posts: 1
Joined: Fri Feb 08, 2013 6:58 am

Postby james.billings » Mon Feb 11, 2013 4:26 pm

You can only package up one script- but once done, you could run that against whichever server/databases you want, as detailed here

For reference, the generated package offers the following command-line options:

Code: Select all
Red Gate SQL Packager 'PackagerTest'
Command line options:

   /server:<server>
   The name of the sql server. The default is (local)

   /database:<database>
   The name of the database

   /username:<username>
   The user name for the database

   /password:<password>
   The password for the database

   /quiet
   Indicates the package will run without any user interface

   /makedatabase
   Indicates the database will be created in the specified server

   /makeupgrade
   Indicates the database will be upgraded on the specified server

   /presql:<filename>
   Allows you to specify a file containing a SQL script to run before the package executes

   /postsql:<filename>
   Allows you to specify a file containing a SQL script to run after the package executes

Examples:

  - PackagerTest.exe /server:MyServer /database:MyDatabase /makedatabase
  - PackagerTest.exe /server:MyServer /database:MyDatabase /username:MyUserName /password:MyPassword

james.billings
 
Posts: 1146
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Handling Nested Sql scripts possible with RedGate ?

Postby bahrani » Tue Apr 30, 2013 2:33 pm

Hi,

I have one scenario wherein i have one sql script (Main.sql) to which i pass some arguments and execute the sql script using SQLCMD command
(e.g.
SQLCMD -S %1 -U %2 -P %3 -d %4 -i Main.sql -v Argument1="%4" -v Argument2="%5" -v Argument3="%4" -v filepath="%CD%" -o sql_Log_Module.txt)

This sql script (Main.sql) internally calls some more sql scripts and these internal nested scripts use the parameters passed to the main script i.e., "Main.sql" (mentioned above)

Internal scripts also have the stored procedures which gets executed

Currently we execute sql script (Main.sql) directly in batch file with the help of SQLCMD command, but we are thinking to use Red Gate (SQL Packager) instead of SQLCMD in batch file

It will be great if you provide some inputs on whether this can be done with the help of RedGate or not, i mean to say whether this is possible with the help of RedGate or not

Thanks in advance,
Ishant
bahrani
 
Posts: 3
Joined: Tue Apr 30, 2013 12:34 pm
Location: Mumbai


Return to SQL Packager 6

Who is online

Users browsing this forum: No registered users and 0 guests