EXIT (rcli)

is a rcli special command, that stops the parsing of the SQL file and discards all the lines beyond.

Syntax

QUIT

EXIT

EXIT ( [integer_expression] )

Arguments

integer_expression
optional argument. It specifies the value to return to the caller, of type int.

Return Types

Returns an int.

Remarks

If the argument is omitted, this command returns 0.

QUIT is the same as EXIT without argument.

When the command EXIT or QUIT is encountered in the script, the RSQL Client stops the parsing of the file immediately. All remaining lines are just ignored.

This means that if the script contains more batches after this point, RSQL Client will not send them to the server and they will not be executed.

This command is recognized only if it appears at the beginning of a line, with no blanks before.

Examples

PRINT 'This is the first batch';
GO

PRINT 'This is the second batch';
EXIT(123)

PRINT 'This is the 3rd batch'; -- this batch is not sent to the server, and will not be executed
GO

PRINT 'This is the 4th batch'; -- this batch is not sent to the server, and will not be executed
GO

The result is:

2016/03/20 02:35:01 --- executing batch sample.sql:1 ---
This is the first batch
2016/03/20 02:35:01 return code: 0

2016/03/20 02:35:01 --- executing batch sample.sql:3 ---
This is the second batch
2016/03/20 02:35:01 return code: 123
RSQL, a simple alternative to Microsoft SQL Server