LOAD

Extension command LO

Loads records from a CSV file into a table, one query at a time

Arguments

LOAD <updateMode> <tableName> <fileName> where: <updateMode> is CREATE or UPDATE <tableName> is a valid table name <fileName> is a valid file name

Examples

LOAD CREATE customer c:\temp\queries.txt
LOAD UPDATE customer c:\temp\queries.txt

Notes

Loads a semicolon-separated CSV file into a table, one row at a time: LOAD <CREATE|UPDATE> <tableName> <fileName>. All three arguments are mandatory, and tableName must already exist (checked up front, with a clear error if it doesn't).

The file's first line must be a header naming real columns of tableName; columns can be listed in any order and only the ones you need have to be present. In CREATE mode, every header column is inserted. In UPDATE mode, the <em>first</em> header column is the key used to locate the row (it is not itself updated) and the remaining columns are set. Each value is converted to the target column's real type (numeric, boolean, text, or dd-MMM-yy dates, plus the literal sysdate); a value that doesn't convert is stored as NULL rather than aborting the row. If fileName has no path, it is resolved inside the configured export folder (DefaultFolder in BroadSQL.ini).

A row whose insert/update fails is skipped (logged) and the rest of the file still runs. A <fileName-without-extension>_LOG.txt file is always written next to the source file with one entry per row, and the console reports how many rows were attempted versus actually inserted/updated. For large files, BATCHLOAD runs the whole file as one transaction and is faster.

Last modified in release 4.9.8.