Contents IndexEntering multiple statements in the ISQL Command window Command files with parameters

User's Guide
   Part II. Tutorials
     Chapter 13. Command Files
      Saving statements as command files

You can also save the commands entered in the previous section to a command file. This keeps a permanent record of the SQL commands so they can be used later if you wish.

To save statements as a command file:

  1. Choose File ->Save As from the menu bar. You are then prompted for a filename.
  2. Type transferand press enter.
  3. The command file can be run using the ISQL READ command, but you should rollback the changes first. Press the escape key to clear the editor and then execute the ROLLBACK WORK command.
  4. Now enter the following command:
         READ transfer
    

    This command executes the command filetransfer which contains the three commands that we saved previously. As each command is executed, it flashes up in the Command window.

  5. You can load command files back into the Command window by choosing File ->Open from the menubar.
  6. Entertransfer when prompted for the file name. Notice that the commands have been loaded back into the editor just the way they were when they were saved.

What are command files?

Command files are just ASCII files containing the ISQL commands as you see them in the editor. You can use any editor you like to create command files. You can include comment lines along with the SQL statements to be executed. Comments begin with a percent sign (%). The ISQL READ command is used to execute command files. Alternatively, they can be loaded into the ISQL Command window and executed directly from there.

The Command window in ISQL has a limit of 500 lines. For command files larger than this, you should use a generic editor capable of handling large files. The READ command has no limit on the number of lines that can be read.

Contents IndexEntering multiple statements in the ISQL Command window Command files with parameters