Batch File

Definition

The SQLCLI can import commands from a batch file and process them in the background; see Executing Commands.

Structure

The individual commands are in individual rows and separated by a separator.

You can specify the separator used in the batch file between two commands using the -c <separator> call option. The default value is //

Do not enter additional spaces in the batch file. The following two separators, for example, are not identical for the database system:

//

<blank>//

Example

CREATE TABLE city
(zip                CHAR (5)    KEY CONSTRAINT zip BETWEEN '10000' AND '99999',
 name               CHAR(20)    NOT NULL,
 state              CHAR(2)     NOT NULL)
//
CREATE TABLE customer
(cno                FIXED (4)   KEY CONSTRAINT cno BETWEEN 1 AND 9999,
 title              CHAR (7)    CONSTRAINT title IN ('Mr', 'Mrs', 'Company'),
 firstname          CHAR (10)   ,
 name               CHAR (10)   NOT NULL,
 zip                CHAR (5)    CONSTRAINT zip BETWEEN '10000' AND '99999',
 address            CHAR (25)   NOT NULL,
 FOREIGN KEY (zip) REFERENCES city ON DELETE RESTRICT)
//
\dt customer
//
COMMIT

In this example, AUTOCOMMIT mode is deactivated. To ensure that the SQLCLI executes the SQL statements immediately after the batch file has been imported, the batch file must contain an explicit COMMIT.

Default value of the database system: activated AUTOCOMMIT mode