Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

Interactive SQL Online Help Interactive SQL Version 16.0 » Using DBISQL commands

output

Description

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

Syntax

Syntax 1:

output to file_name
     [ append ]
     [ byte order mark { on | off }
     [ column widths ( integer, ... ) ]
     [ delimited by string ]
     [ encoding encoding ]
     [ escape character character ]
     [ escapes { on | off}
     [ format output_format ]
     [ hexadecimal { on | off | asis } ]
     [ quoate string [ all ] ]
     [ verbose ]
     [ with column names]
output_format :
     text 
     | fixed
     | html
     | sql 
     | xm
encoding : string | identifier

Syntax 2 – Output to an ODBC data source:

output 
     using connection_string
     into destination_table_name
     [ create table { on | off } ]
connection_string :  
     { dsn = odbc_data_source
     | driver = odbc_driver_name [; connection_parameter = value [; ... ] ] }

Parameters

Examples

Places the contents of the employee table in a file in text format:

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

Places 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