Running SQL command files in Interactive SQL

You can execute command files in any of the following ways:

  • You can run a command file without loading it into the SQL Statements pane.

    To run a command file immediately

    1. In Interactive SQL, choose File » Run Script.

    2. Locate the file, and click Open.

      The contents of the specified file are run immediately. A Status window appears to show the execution progress.

      The Run Script menu item is the equivalent of a READ statement. See below for an example of the READ statement.

  • You can also run a command file without loading it into the SQL Statements pane with the Interactive SQL READ statement.

    To run a command file using the Interactive SQL READ statement

    • In the SQL Statements pane, type the following command:

      READ 'c:\\filename.sql';

      In this statement, c:\filename.sql is the path, name, and extension of the file. Single quotation marks (as shown) are required only if the path contains spaces.

      For more information, see READ statement [Interactive SQL].

  • You can supply a command file as a command line argument for Interactive SQL.

    To run a command file in batch mode (Command prompt)

    • Run the dbisql utility and supply a command file as a command line argument.

      For example, the following command runs the command file myscript.sql against the SQL Anywhere sample database.

      dbisql -c "DSN=SQL Anywhere 11 Demo" myscript.sql
  • You can load a command file into the SQL Statements pane and execute it directly from there.

    To load commands from a file into the SQL Statements pane

    1. Choose File » Open.

    2. Locate the file, and click Open.

      The commands are displayed in the SQL Statements pane where you read, edit, or execute them.

    On Windows platforms you can make Interactive SQL the default editor for .sql command files. This lets you double-click the file so that its contents appears in the SQL Statements pane of Interactive SQL. See Setting Interactive SQL as the default editor for .sql files.

  • You can also a load command file into the SQL Statements pane from your favorites.

    See Using favorites.