In general, there is no need to change the command delimiter. You should leave it as a semicolon.
An alternative to using a semicolon or another string as a statement delimiter is to enter the separator go on a line by itself, at the beginning of the line. See Batches.
Specifying go on its own line at the beginning of the line is always recognized as a command delimiter, even if you set the command_delimiter
option to a different value.
The command_delimiter value can be any string of characters with the following restrictions:
If the delimiter contains any one of & (ampersand), * (asterisk), @ (at sign), : (colon), . (period), = (equals), ( (left
parentheses), ) (right parentheses), or | (vertical bar), the delimiter must not contain any other character. For example,
* is a valid delimiter, but ** is not.
You should not use an existing keyword as a command separator.
The command delimiter can be any sequence of characters (including numbers, letters, and punctuation), but it cannot contain
embedded blanks. As well, it can contain a semicolon, but only as the first character.
If the command delimiter is set to a string beginning with a character that is valid in identifiers, the command delimiter
must be preceded by a space. The command delimiter is case sensitive. You must enclose the new command delimiter in single
quotation marks. When the command delimiter is a semicolon (the default), no space is required before the semicolon.
The following example sets the command delimiter to a tilde:
SET OPTION command_delimiter='~';
You can also use the Interactive SQL -d option to set the command delimiter without including a SET OPTION command_delimiter
statement in a .sql file. For example, if you have a script file named test.sql that uses tildes (~) as the command delimiter, you could run: