Options

Creating EXE with multiple scripts and custom commandline

TadulTadul Posts: 2
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

Comments

  • Options
    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:
    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
    
    
    Systems Software Engineer

    Redgate Software

  • Options
    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
Sign In or Register to comment.