Executing command files

Command files are text files that contain SQL statements, and are useful if you want to run the same SQL statements repeatedly. You can use Interactive SQL to open, view, run, and save command files.

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

  • You can use the Interactive SQL READ statement to execute command files. For example, the following statement executes the file temp.sql:

    READ temp.sql;
  • You can load a command file into the SQL Statements pane and execute it directly from there.

    You load command files into the SQL Statements pane by choosing File » Open. Enter the file name, for example temp.sql, when prompted.

  • You can run a command file without loading it by choosing File » Run Script.

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

See Run SQL command files in Interactive SQL.

Setting Interactive SQL as the default editor for .sql files

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.

To make Interactive SQL the default editor for .sql files
  1. From Interactive SQL, choose Tools » Options.

  2. In the left pane, click General.

  3. Click Make Interactive SQL The Default Editor For .SQL Files And Plan Files.

  4. Click OK.

For more information about using Interactive SQL with command files, see: