ERRSTOP

Restriction: This topic applies to Windows environments only.

This batch SQL command causes the system to pause for a keystroke when it encounters an error. Since this is the default mode, the ERRSTOP command is typically used to return to ERRSTOP operation following the execution of a NOSTOP command (see NOSTOP command, below).

The syntax is:

ERRSTOP;

The ERRSTOP command must be placed immediately after the query on which you want it to start taking effect. Once an ERRSTOP command is executed, it will remain in effect for the rest of the script, or until a NOSTOP command is encountered. Together, the ERRSTOP and NOSTOP commands can be used to selectively enable or disable error processing at certain points in the batch file.

For example:

UPDATE employee
SET com = 0
WHERE dept = "2020";
NOSTOP;          --Do not stop on error
UPDATE customer SET balance=0 
WHERE balance > 0;
ERRSTOP;          --Stop on error

In this example, the system ignores errors that occur when updating the EMPLOYEE table, but stops on errors that occur when updating the CUSTOMER table.