Use this statement to read Interactive SQL statements from a file.
READ [ ENCODING encoding ] filename [ parameter ] ...
encoding : identifier or string
The READ statement reads a sequence of Interactive SQL statements from the named file. This file can contain any valid Interactive SQL statements, including other READ statements. READ statements can be nested to any depth. If the file name does not contain an absolute path, Interactive SQL searches for the file. Interactive SQL first searches the directory of the calling file (if there is one), then the current directory, and then the directories specified in the environment variable SQLPATH, and then the directories specified in the environment variable PATH. If the named file has no file extension, Interactive SQL searches each directory for the same file name with the extension .sql.
The ENCODING clause allows you to specify the encoding that is used to read the file. The READ statement does not process escape characters when it reads a file. It assumes that the entire file is in the specified encoding.
With Interactive SQL, if the ENCODING clause is not specified, the encoding that is used to read the file is determined in the following order:
For more information about Interactive SQL and encodings, see default_isql_encoding option [Interactive SQL].
Parameters can be listed after the name of the command file. These parameters correspond to the parameters named in the PARAMETERS statement at the beginning of the statement file. See PARAMETERS statement [Interactive SQL])
Parameter names must be enclosed in square brackets. Interactive SQL substitutes the corresponding parameter wherever the
source file contains {parameter-name}
, where parameter-name is the name of the appropriate parameter.
The parameters passed to a command file can be identifiers, numbers, quoted identifiers, or strings. When quotes are used around a parameter, the quotes are put into the text during the substitution. Parameters that are not identifiers, numbers, or strings (contain spaces or tabs) must be enclosed in square brackets ([ ]). This allows for arbitrary textual substitution in the command file.
If not enough parameters are passed to the command file, Interactive SQL prompts for values for the missing parameters.
When executing a reload.sql file with Interactive SQL, you must specify the encryption key as a parameter. If you do not provide the key in the READ statement, Interactive SQL prompts for the key. See Interactive SQL utility (dbisql).
The location of filename is determined based on the location of the READ statement, as follows:
None.
None.
SQL/2003 Vendor extension.
The following are examples of the READ statement.
READ status.rpt '160'; READ birthday.sql [>= '1988-1-1'] [<= '1988-1-30']; |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |