Tech Tip: INSERT command now supports insertion of file contents
PRODUCT: 4D | VERSION: 11.3 | PLATFORM: Mac & Win
Published On: November 25, 2008
As of 4D v11 SQL Release 3, the SQL INSERT command can now use the contents of an external file to set the values of a new record.
Example:
Begin SQL |
The INFILE keyword must only be used with VARCHAR type expressions. When the INFILE keyword is passed, the string following it is evaluated as a file pathname; if the file is found, the contents of the file are inserted into the corresponding column. Only fields of the Text or BLOB type can receive values from an INFILE. The contents of the file are transferred as raw data, with no interpretation.
The file searched for must be on the computer hosting the SQL engine, even if the query comes from a remote client. Similarly, the pathname must be expressed respecting the syntax of the operating system of the SQL engine. It can be absolute or relative.