output

Description

Imports data into a database table from an external file or from the keyboard.

Syntax

output to filename
[ append ]
[ verbose ]
[ format output-format ]
[ escape character character ]
[ escapes { on | off}
[ delimited by string ]
[ quote string [ all ] ]
[ column widths (integer , . . . ) ]
[ hexidecimal { on | off | asis } ]
[ encoding encoding ]
output-format :
ascii | dbase | dbasell| dbaselll
| excel | fixed | foxpro | lotus | sql | xml  
encoding : string or identifier 

Parameters

Examples

place the contents of the employee table in a file in ASCII format:

select *
from employee
go
output to employee.txt
format ASCII 

place the contents of the employee table at the end of an existing file, and includes any messages about the query in this file as well:

select *
from employee
go
output to employee.txt append verbose 

Suppose you need to export a value that contains an embedded line feed character. A line feed character has the numeric value 10, which you can represent as the string ‘\x0a’ in a SQL statement. If you execute the following statement, with hexidecimal set to on,

select ‘line1 n x0aline2’
go
output to file.txt hexidecimal on 

you get a file with one line in it containing the following text:

line10x0aline2 

But if you execute the same statement with hexidecimal set to off, you get the following:

line1 n x0aline2 

Finally, if you set hexidecimal to asis, you get a file with two lines:

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.

Usage

Permissions

Any user can run this command.

Side effects

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.

See also

input