Go Up to isql Command Reference
Read and execute commands from the named file.
Name of the file containing SQL statements and SQL commands
INPUT reads commands from <filename> and executes them as a block. In this way,
INPUT enables execution of commands without prompting. <filename> must contain SQL statements or
Input files can contain their own
INPUT commands. Nesting
INPUT commands enables
isql to process multiple files. When
isql reaches the end of one file, processing returns to the previous file until all commands are executed.
INPUT command is intended for noninteractive use. Therefore, the
EDIT command does not work in input files.
INPUT <filename> from within an
isql session has the same effect as using
filename from the command line.
Unless output is redirected using
OUTPUT, any results returned by executing filename appear on the screen.
You can optionally delimit the filename with double or single quotes. This allows you to use filenames with spaces in
Examples: For this example, suppose that file
add.lst contains the following
INSERT INTO COUNTRY (COUNTRY, CURRENCY) VALUES ('Mexico', 'Peso');
To execute the command stored in
For the next example, suppose that the file,
table.lst, contains the following
SHOW TABLE COUNTRY; SHOW TABLE CUSTOMER; SHOW TABLE DEPARTMENT; SHOW TABLE EMPLOYEE; SHOW TABLE EMPLOYEE_PROJECT; SHOW TABLE JOB;
To execute these commands, enter:
To record each command and store its results in a file named
SET ECHO ON; OUTPUT table.out; INPUT table.lst; OUTPUT;