ReadODBC (FPScript)

21.09.2021

Reads one or more columns from a table or data source using ODBC.

Syntax

ReadODBC(Connection, Query, [ UTC = FALSE ] [ , Result = ODBC_RESULT_DATASERIES ])

 

The syntax of the ReadODBC function consists of the following parts:

Part

Description

Connection

The following information is possible here:

- a file with the description of a link to a data source (.DSN extension),

- a Microsoft Excel workbook (.XLS extension) or a Microsoft Access project database (.MDB extension), as long as the associated ODBC driver is installed, or

- a string that can be used for establishing a link to a data source.

Permitted data structures are scalar value. Supported data types are string.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Query

SQL statement used to address the data column in the specified data source. The format of queries generated by the OBDC Data data link object is

SELECT <column> FROM <table>

where <column> and <table> represent the table and column selected in the import dialog. You can expand the query, such as by using a sorting command.

Permitted data structures are scalar value. Supported data types are string.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

UTC

This argument is only taken into account if the data column contains calendar time (date and time) values. The value TRUE specifies that the data stored in the data base should be interpreted as Universal Time Coordinated (UTC). Otherwise, data is interpreted as local time.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value FALSE.

Result

Specifies how the result shopuld be returned.

The argument Result can have the following values:

Constant

Meaning

ODBC_RESULT_DATASERIES

Result as data series. Only the first column of the query is returned.

ODBC_RESULT_LIST

Result as list. All columns of the query are returned.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value ODBC_RESULT_DATASERIES.

Remarks

If you choose ODBC_RESULT_DATASERIES, the function always provides only the first column of a query as the result, even if you formulate the query in such a way that it basically provides several columns as the result. Binary SQL data types are not supported.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

ReadODBC("ODBC;DRIVER={Microsoft Access Driver (*.mdb)};DSN='';DBQ=c:\\examples\\database.mdb", "SELECT ExampleColumn FROM ExampleTable")

Imports the column 'ExampleColumn' from the 'ExampleTable' table found in the Microsoft Access project database 'database.mdb'.

See Also

File Import

Share article or send as email:

You might be interested in these articles