4D v16.3

IMPORT ODBC

Home

 
4D v16.3
IMPORT ODBC

IMPORT ODBC 


 

IMPORT ODBC ( sourceTable {; project {; *}} ) 
Parameter Type   Description
sourceTable  String in Name of table in ODBC data source
project  BLOB in Contents of import project
in New contents of import project (if * is passed)
Operator in Display of import dialog box and project update

The IMPORT ODBC command is used to import data from the sourceTable table of an external ODBC source. 

If you call the IMPORT ODBC command outside of a connection previously opened using the SQL LOGIN, command, the ODBC data source selection dialog box is displayed:

Windows

Mac OS

If the user clicks Cancel in the dialog box, execution is stopped and the system variable OK is set to 0.

Note: 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, 4D displays the ODBC import dialog box which allows the user to configure the operation. For more information about this dialog box, refer to the Design Reference manual.
If you pass a BLOB containing a valid ODBC import project in the project parameter, the import 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. ODBC import projects are saved via the ODBC import dialog box.

You can also use the IMPORT ODBC 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. Please note that projects generated in the ODBC import dialog box are not compatible with the commands or the standard import dialog box of 4D.

The optional * parameter, if it is set, displays the ODBC data import 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.

If the user clicks Cancel in either of the two dialog boxes (for selecting the data source or the import settings), the system variable OK is set to 0. If the import is carried out correctly, the system variable OK is set to 1.



See also 

EXPORT ODBC
Overview of SQL Commands

 
PROPERTIES 

Product: 4D
Theme: Import and Export
Number: 880

The OK variable is changed by the command

 
HISTORY 

Created: 4D 2004
Renamed: 4D v12

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)