Saving, loading, and running command files

You can save the commands in the SQL Statements pane so that they are available for future Interactive SQL sessions. The file in which you save them is called a command file, or a script.

NoteODBC applications, including Interactive SQL applications, automatically set certain database options to values mandated by the ODBC specification. These settings overwrite those set in the LOGIN_PROCEDURE database option. For details and a workaround, see “LOGIN_PROCEDURE option,” in Chapter 2, “Database Options” of Reference: Statements and Options.

When you begin a new session, you can load the contents of a command file into the SQL Statements pane, or you can run the contents immediately.

StepsSaving the commands in the SQL Statements pane

  1. Choose File | Save As.

  2. In the Save dialog, specify a location, name and format for the file. Click Save when finished.

StepsLoading commands from a file into the SQL Statements pane

  1. Choose File | Open.

  2. In the Open dialog, find and select the file. Click Open when finished.

StepsRunning a command file immediately

  1. Choose File | Run Script.

  2. In the Open dialog, find and select the file. Click Open when finished.

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

The Run Script menu item is the functional equivalent of a READ statement. For example, in the SQL Statements pane, you can also run a command file by typing:

READ 'c:\filename.sql'

where c:\filename.sql is the path, name, and extension of the file. You can enclose the string in single quotation marks (as shown) if you want, but they are required only if the path contains embedded spaces.