The command line processor lets you issue SQL statements against a host or AS/400 database server, preceded by db2. For differences between host and AS/400 SQL and DB2 Connect SQL, see Host or AS/400 Server SQL Statements Supported by DB2 Connect and Host or AS/400 Server SQL Statements Rejected by DB2 Connect.
To invoke the command line processor in interactive input mode, do the following:
Note: | You can also invoke the command line processor in interactive input mode by entering the db2cmd command followed by the db2 command at an MS-DOS prompt. |
In interactive input mode, the prompt looks like this:
db2 =>
In interactive input mode, you do not have to enter DB2 commands with a db2 prefix; instead, you just enter the DB2 command. For example:
db2 => list database directory
To enter operating system commands in interactive mode, precede the operating-system command with an exclamation mark (!). For example:
db2 => !dir
If you need to enter a long command that does not fit on one line, enter a space followed by the line continuation character, \. When you have reached the end of the line, press the Enter key to continue entering the command on the next line. For example:
db2 => select empno, function, firstname, lastname, birthdate, from \ db2 (cont.) => employee where function='service' and \ db2 (cont.) => firstname='Lily' order by empno desc
To end interactive input mode, enter the quit command.
Before you can use the command line processor, it must be bound, as described in Binding Applications and Utilities.
For more information on SQL commands, refer to the Command Reference.