Was this helpful?
COPY VWLOAD (X100 Only)
Valid in: SQL, ESQL, OpenAPI
The COPY...VWLOAD statement copies the contents of a file to an X100 table using the VWLOAD operator. This operation is like using vwload -c on the command line, except that the load can be done from within a multi-statement transaction instead of in a separate session.
Note:  COPY VWLOAD has the following limitations at this time: The WITH options ATTRIBUTES and DATEFORMAT do not work. If you specify an invalid or mistyped parameter, it is silently ignored and the load executes (to the extent possible as if that parameter was not there) instead of returning an error.
This statement has the following format:
COPY tablename() VWLOAD FROM 'file1', 'file2', 'file3', ... [WITH option {,option}]
tablename()
Specifies the name of the table to be loaded. The column list is empty and not supported.
'file1', 'file2', 'file3'
Specifies the files from which data is read, using a full or relative path.
WITH option {,option}
Specifies optional WITH clause options:
INSERTMODE=
Specifies the mode to use for inserts and merges. Valid modes are:
ROW
Inserts through the PDT (allows concurrent inserts)
BULK
Appends directly to disk (does not allow concurrent inserts)
ROLLBACK=
Turns "roll back on error" on or off.
ON
(Default) Rolls back on error.
OFF
Does not roll back the load transaction when errors were encountered, causing partial data to be loaded.
CHARSET='charset'
Specifies the input character set.
Default: no conversion
ERRCOUNT=n
Terminates after the first n errors in all input files. Default: 0 (do not terminate).
ESCAPE='escapechar'
Specifies the escape character to use. This allows escaping of single characters to allow a delimiter character to be part of a field (for example: \) or to allow a quote character to be part of a quoted string.
The argument must be a single ASCII character or an empty string. If the argument is an empty string, this functionality is disabled. To specify a control character, use an escape sequence.
Default: none
ESCAPES
Interprets data escape sequences
FDELIM='fielddelim'
Specifies field delimiter to use. The delimiter must be a single character. To specify a control character, use an escape sequence.
Default: "|"
HEADER
Skips header line in files.
IGNFIRST
Ignores the first field.
IGNLAST
Ignores the last field.
LOG='dir'
Logs rejected rows and corresponding errors to the specified file. The file is created by the operation.
NULLVALUE='nullvalue'
Defines the string that identifies NULL values. Default: ' '
QUOTE='quotechar'
Specifies the quote character(s) to use. This allows the input to contain quoted fields (for example "Doe, John"), which may contain field or record delimiter characters. To include a quote character inside a quoted field, enter it twice in the input--for example: "The ""BIG"" Boss". When using distinct open and close quote characters, enter only the close quote character twice--for example: [The [BIG]] Boss].
The argument must be one or two ASCII characters or an empty string.
If the argument is an empty string, this functionality is disabled. If the argument is two characters, the first character is used as the opening quote character, and the second as the closing quote character. For example, specify "[]" to allow [quoted string].
To specify a control character, use an escape sequence.
Default: none
RDELIM='recorddelim'
Specifies record delimiter to use. The delimiter must be a single character. To specify a control character, use an escape sequence.
Default: "\n"
STRICTNULLS
Uses strict NULL value checking. This distinguishes between plain and quoted or escaped occurrences of a NULL representation. For example, NULL is a NULL value, whereas "NULL" is a 4-character string value. By default, vwload does not make this distinction. This option allows proper loading of some data generated by MySQL and PostgreSQL.
SUBSTITUTE='substitutechar'
Substitutes the specified character for any invalid input character during character set conversion. When no substitute character is provided, an invalid input character is considered an error condition. Specifying a substitute character allows records that contain invalid characters to be loaded successfully.
The argument must be a single Unicode character or an empty string. If the argument is an empty string, the functionality is disabled.
To specify a control character or Unicode code point that cannot easily be typed on the keyboard, use an escape sequence.
TEXTMODE
Opens input files in text mode and does not perform newline conversion. On Linux, this may gain a 5 to 10 percent performance improvement. On Windows, there is no known advantage to using this option. (By default, vwload opens files in binary mode and performs automatic newline conversion, transparently handling text formats of various operating systems.)
Note:  When using -T on Windows, any ^Z (ASCII SUB) character in the input is interpreted as End-Of-File by the Windows library, and causes vwload not to see any data following the first such character.
WORK_DIR
Specifies a directory that will be used for relative paths in filenames. Default is /tmp, so specifying non-absolute paths without a WORK_DIR tells X100 to look for the files in /tmp.
Last modified date: 01/30/2023