version 2004
SQL EXPORT (sourceTable{; project{; *}})
Parameter | Type | Description | |
sourceTable | String | Name of table in ODBC data source | |
project | BLOB | Contents of export project | |
New contents of export project (if * is passed) | |||
* | * | Display of export dialog box and project update |
Description
The SQL EXPORT command is used to export data in the sourceTable table of an external ODBC source. The connection parameters (source name, user and password) are included in the project BLOB.
Notes:
The project contains all the export parameters, in particular the data source and the exported tables and fields. You set these parameters in the ODBC export dialog box, then you can save them in a file on disk if necessary. For more information, refer to the Design Reference manual.
The projects generated in the ODBC export dialog box are not compatible with the commands or the standard export dialog box of 4D.
This command cannot be used in the case of connections with the internal SQL kernel of 4D.
If you do not pass the optional project parameter, SQL EXPORT displays a dialog box for selecting the ODBC data source:
Windows
Mac OS
Once you have selected the source, the 4D ODBC export dialog box appears, allowing the user to configure the operation. If the user clicks Cancel in either of the two dialog boxes, execution is stopped and the system variable OK is set to 0.
If you pass a BLOB containing a valid ODBC export project in the project parameter, the export will be carried out directly, without any user intervention. To do this, you simply need to load a project that has been saved on disk beforehand into the field or the BLOB variable that you pass in the project parameter, using the DOCUMENT TO BLOB command.
You can also use the SQL EXPORT command with an empty project parameter and the optional * parameter, then store the project parameter in a BLOB field (see below). On the one hand, this solution lets you store the project with the data file and, on the other, to avoid the phase of loading it from the disk into a BLOB.
Note: Refer to the EXPORT DATA command for an example concerning the definition of an empty project.
The optional * parameter, if it is set, displays the ODBC data export dialog box with the settings defined in project (if any). This allows you to use a predefined project while still being able to modify one or more parameters. Moreover, in this case, the project parameter contains the parameters of the "new" project after the dialog box is closed. You can then store it in a BLOB field, in a file on disk, etc.
See Also
System Variables or Sets
If the user clicks Cancel in either of the two dialog boxes (for selecting the data source or the export settings), the system variable OK is set to 0. If the export is carried out correctly, the system variable OK is set to 1.