Ispirer Website Ispirer Toolkit Overview Free Trial

How to Convert SQL Scripts in Command Line Mode

First of all we need to open a command line window by running Start → Run → cmd.exe

Using tool for script conversion will help you to convert separate files with SQL code inside.

The command syntax is:

   sqlways.exe 
   /D=Fixed 
   /SOURCE=<source DB>
   /TARGET=<target DB>
   /DIR=<result_directory> 
   /PRJF=<project_file_path>
   /INI=<ini_file_path>
   /TRACE
   /RPT_TYPE=1

Note: SQLWays command line options are case insensitive and their order is insignificant.

Here is the list of parameters used in the provided command line:

  • sqlways.exe - this is the name of the utility that performs the conversion. If required it can be specified with the full path to the utility.
  • /D - FIXED value defines that the script conversion is performing.
  • /TARGET- specifies the target database.
  • /SOURCE- specifies the source database.
  • /DIR - specifies the location of the generated files (output directory).
  • /INI - specifies the options file. Options file is a file that stores all the options supported by the tool. Options file with the default settings is located in the directory like: “C:\Users\[user_name]\Documents\Ispirer\CodeWays 10\”. You can use it as a default options file. More information about the supported options can be found here. Options are developed to change the default conversion output. For the first time we recommend to run the conversion with default settings. If you expect the result to be different, you may contact our technical team to receive details: support@ispirer.com
  • /RPT_TYPE - specifies the report type
  • /PRJF - specifies the path to the project file. In this file information about the objects specified for conversion is stored. You can find more information about the project file here.

Optional parameters:

  • /TRACE - the conversion will be done in Trace mode.


Information about all the supported command line options can be found here: Command Line Options

Sample of the command line:

   "C:\Program Files\Ispirer\IspirerToolkit10\sqlways.exe" /D=FIXED /PRJF="C:\Users\User1\Documents\Ispirer\CodeWays 10\sqlways.xml" /DIR="C:\Users\User1\Documents\Ispirer\CodeWays 10\Result" /SOURCE=Adaptive Server Enterprise /TARGET=Microsoft SQL Server /INI="C:\Users\User1\Documents\Ispirer\CodeWays 10\sqlways_app.ini" /TRACE /RPT_TYPE=1


Easiest Way to Get Command Line

The easiest way to prepare correct command line is to run the Ispirer CodeWays tool, select all the required objects for conversion and on the “Summary” page, you will see the generated command line:

You can just copy the generated command line and run it.


Running Prepared Command Line

After we prepared the command line with appropriate set of options we need to run it in the command line prompt.

And as a result, in directory specified in /DIR option you may find the following files generated:

  • sqlways.log - conversion log that saves the messages of conversion process;
  • sqlways.trc - trace file that stores the detailed information about conversion process (in case /TRACE argument has been set);
  • reports folder with html reports;
  • the appropriate sql file(s) with converted SQL code. The sql files contains the code is ready to be executed in target database.

Thus, the conversion process is finished.


When performing script-based migration using the Ispirer Toolkit in command-line mode, you can control which scripts are included in the conversion by configuring the sqlways.xml project file. This is particularly useful when you want to convert only a subset of objects instead of processing all files in a folder.


1. Using <Scripts> to Specify Individual Files

To include specific SQL script files for conversion, use the <Scripts> section within the <SelectedObjects> block in your sqlways.xml file. Each script is represented by a <Script> element, where you define:

  • DDLFile: A unique identifier for the object (optional but recommended for traceability).
  • file: The full path to the input script file.
  • name: The filename to display or reference during migration.

Example:

   <DatabaseInfo>
     <SelectedObjects>
       <Scripts>
         <Script DDLFile="Bookings" file="S:\ASE\DDL_Objects\Tables\Bookings.sql" name="Bookings.sql"/>
         <Script DDLFile="Users" file="S:\ASE\DDL_Objects\Tables\Users.sql" name="Users.sql"/>
         <!-- Add as many Script entries as needed -->
       </Scripts>
     </SelectedObjects>
   </DatabaseInfo>

In this example, only the Bookings.sql and Users.sql files will be included in the migration process. All other scripts will be ignored.


2. How to Run the Migration

Once you've configured the sqlways.xml file to include only the desired scripts:

  • Open the command line.
  • Run the conversion using the sqlways.exe command (as shown above), including the path to the sqlways.xml file in the /PRJF parameter.

Only the files listed in the <Scripts> block will be processed and converted.


If you have any questions on how to run the migration in batch mode, please contact our technical team: support@ispirer.com