Save, load, and run command files

You can save the commands currently present in the SQL Statements pane so they are available for future Interactive SQL sessions. The file in which you save them is called a command file.Command files are text files containing SQL statements. You can use any editor you like to create command files. You can include comment lines along with the SQL statements to be executed. These command files are commonly called scripts.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 from the SQL Statements pane to a file

  1. Choose File | Save.

  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. The Run Script menu item is the equivalent of a read statement. For example, in the SQL Statements pane, you can also run a command file by typing the following, where 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:

    READ "c:\filename.sql"
    
  3. In the Open dialog, find and select the file. Click Open when finished.

    The Run Script menu item is the equivalent of a READ statement. For example, in the SQL Statements pane, you can also run a command file by typing the following, where 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:

    READ 'c:\filename.sql'