You are on page 1of 1

Chapter 2: Inserting 65

<prompt_input_option_list> ::= <input_option_list> including PROMPT option


<inline_input_option_list> ::= <input_option_list> not including FROM or PROMPT
<input_option_list> ::= { <input_option> }
<input_option> ::= INTO [ <owner_name> "." ] <target_table_name> -- required
| "(" <column_name_list> ")" -- default all columns
| FROM <input_file>
| PROMPT
| BY NAME -- for self-describing file formats
| BY ORDER -- default
| COLUMN WIDTHS "(" <column_width_list> ")" -- for FORMAT FIXED
| DELIMITED BY <input_delimiter> -- default ','
| ESCAPE CHARACTER <input_escape_character> -- default '\'
| FORMAT <input_format> -- default ASCII
| NOSTRIP -- default strip unquoted trailing blanks
<input_file> ::= string literal file specification relative to the client
| double quoted file specification relative to the client
| unquoted file specification relative to the client
<column_width_list> ::= <column_width> { "," <column_width> }
<column_width> ::= integer literal column width for FORMAT FIXED
<input_delimiter> ::= string literal containing column delimiter string
<input_escape_character> ::= string literal exactly 1 character in length
<input_format> ::= string literal containing <input_format_name>
| double quoted <input_format_name>
| unquoted <input_format_name>
<input_format_name> ::= ASCII -- default
| DBASE -- input is in DBASEII or DBASEIII format
| DBASEII -- a self-describing file format
| DBASEIII -- a self-describing file format
| EXCEL -- a self-describing file format
| FIXED
| FOXPRO -- a self-describing file format
| LOTUS -- a self-describing file format
<inline_data> ::= lines of data immediately following the INPUT statement
<end_of_input_marker> ::= END -- all by itself on a separate line
| end of the executed lines in the SQL Statements pane
| end of file in the ISQL command file
The default input file format is comma-delimited ASCII text, with each line rep-
resenting a separate row. Here is the table from the first example from the
previous section, together with an INPUT statement instead of LOAD TABLE:
CREATE TABLE t1 (
key_1 INTEGER NOT NULL,
col_2 VARCHAR ( 100 ) NULL,
col_3 DECIMAL ( 11, 2 ) NULL,
col_4 TIMESTAMP NULL,
col_5 INTEGER NOT NULL,
PRIMARY KEY ( key_1 ) );

INPUT INTO t1 FROM 'c:\\temp\\t1_a.txt';


Here is the contents of t1_a.txt, same as before:
1,'Hello, World',67.89,2003-09-30 02:15PM,999
2, stripped string without quotes , 0 , , 0
3,,,,
4," double quoted padded string ",0,2003 9 30,-111
In this case, the INPUT statement performs exactly the same function as the
corresponding LOAD TABLE; the contents of t1 are the same:
key_1 col_2 col_3 col_4 col_5
===== ==================================== ===== ======================= =====
1 'Hello, World' 67.89 2003-09-30 14:15:00.000 999

You might also like