Monday, August 22, 2011

How to execute multiple SQL scripts from command line?

How to execute multiple sql scripts from command line?
Script Executor provides one of the most efficient ways of executing SQL scripts from the command line. Let’s assume you have a long list of scripts that need to be executed routinely on a number of servers. Here is how you can do that in a few easy steps using Script Executor:
  1. Launch the Script Executor user interface. Start a new project via File/New Project;
  2. Add database(s) to the project;
  3. Add Sql script(s);
  4. Configure the mappings via Package/Configure. Mappings determine the databases that the scripts should run against. If there is only one database container and one script container, this step is not necessary;
  5. Configure package options via Package/Options;
  6. Save the projects and exit user interface;
Step number 4 above is where you will save a tremendous amount of time is you have a big number of scripts that need to be executed against certain databases.

Once the project has been saved it can then be executed from the command line as follows:
ExecCmd /p: /l:logging_type=1;path=

You can download a free trial version of Script Executor from here...

No comments: