Imports data into a database table from an external file or from the keyboard.
output to filename [ append ] [ verbose ] [ format {ascii | dbase | dbasell| dbaselll | excel | fixed | foxpro | lotus | sql | xml}] [ escape character character ] [ escapes { on | off} [ delimited by string ] [ quote string [ all ] ] [ column widths (integer , . . . ) ] [ hexidecimal { on | off | asis } ] [ encoding {string | identifier}]
ascii – the output is an ASCII format file with one row per line in the file. All values are separated by commas, and strings are enclosed in apostrophes (single quotes). You can change the delimiter and quote strings using the delimited by and quote clauses. If all is specified in the quote clause, all values (not just strings) are quoted.
Three other special sequences are also used. The two characters represent a new line character, “\”, represents a single \, and the sequence \xDD represents the character with hexadecimal code DD. This is the default output format.
dbasell – the output is in DBASEll, which includes column definitions. A maximum of 32 columns can be output. Column names are truncated to 11 characters, and each row of data in each. If the table does not exist, it is created.
dbaselll – the output is a dBASE III format file, which includes column definitions. A maximum of 128 columns can be output. Column names are truncated to 11 characters, and each row of data in each column is truncated to 255 characters.
excel – the output is an Excel 2.1 worksheet. The first row of the worksheet contains column labels (or names if there are no labels defined). Subsequent worksheet rows contain the actual table data.
fixed – the output is fixed format with each column having a fixed width. You can specify the width for each column with column widths. No column headings are output in this format.
If the column widths clause is omitted, the width for each column is computed from the datatype for the column, and is large enough to hold any value of that datatype. The exception is that long varchar and long binary data default to 32K.
foxpro – the output is a FoxPro format file, which includes column definitions. A maximum of 128 columns can be output. Column names are truncated to 11 characters. Column names are truncated to 11 characters, and each row of data in each column is truncated to 255 characters.
html – the output is in the HyperText Markup Language format.
lotus – the output is a Lotus WKS format worksheet. Column names are placed as the first row in the worksheet. There are certain restrictions on the maximum size of Lotus WKS format worksheets that other software (such as Lotus 1-2-3) can load. There is no limit to the size of file Interactive SQL can produce.
SQL – the output is an Interactive SQL input statement required to recreate the information in the table.
XML – the output is an XML file encoded in UTF-8 and containing an embedded DTD. Binary values are encoded in CDATA blocks with the binary data rendered as 2-hex-digit strings. The input statement does not accept XML as a file format.
... escape character '!'
The code page specified with default_isql_encoding (if this option is set)
The code page specified with the -codepage option when Interactive SQL was started
The default code page for the computer Interactive SQL is running
select * from employee go output to employee.txt format ASCII
select * from employee go output to employee.txt append verbose
select 'line1 n x0aline2' go output to file.txt hexidecimal on
line10x0aline2
line1 n x0aline2
line1 line2
You get two lines when you use asis because the embedded line feed character has been exported without being converted to a two-digit hexidecimal representation, and without being prefixed by anything.
The output statement copies the information retrieved by the current query to a file.
You can specify the output format with the optional format clause. If you do not specify the format clause, the Interactive SQL output_format option setting is used.
The current query is the select or input statement that generated the information appearing on the Results tab in the Results pane. The output statement reports an error if there is no current query.
In Interactive SQL, the Results tab displays only the results of the current query. All previous query results are replaced with the current query results.
Any user can execute this command.