Object documentationBatch File Locate this document in the navigation structure

 

SQLCLI can import commands from a batch file and process them in the background.

Per default, AUTOCOMMIT mode is activated. If you deactivate it, the batch file must contain an explicit COMMIT statement to ensure that SQLCLI executes the SQL statements immediately after the batch file has been imported.

Structure

The individual commands are in individual lines 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 //

More information: Overview of All Call Options

Note Note

Do not enter additional spaces in the batch file.

For the database system, the following two separators are different:

//

<blank>//

End of the note.

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.