SQL.BIND macro

Specifies where results from a SQL query are placed when they are retrieved with SQL.RETRIEVE. If this function is not available, you must install the Microsoft ODBC add-in (XLODBC.XLA).

Syntax

SQL.BIND(connection_num, column, reference)

Connection_num    is the unique connection ID of the data source for which you want to define storage.

 

Column    is the number of the result column that is to be bound. Result columns are numbered from left to right starting with 1. If column is omitted then all bindings for connection_num are removed. Column number 0 contains row numbers for the result set. If column number 0 is bound then SQL.RETRIEVE will return row numbers in the bound location.

Reference     is a single cell reference on the worksheet where the results should be placed. If reference is omitted, the binding is removed for the column.

When SQL.RETRIEVE is called, the result rows in this column will be placed in the reference cell and the cells immediately below reference. The number of rows that will be retrieved is one of the SQL.RETRIEVE arguments.

Remarks

Example

SQL.BIND(conn1,1,"[Book1]Sheet1!C1") stores data obtained from the data source conn1 on Sheet1 from left to right in cell C1, starting with column1.

Related Functions

SQL.OPEN   Establishes a connection with a data source

SQL.EXEC.QUERY   Sends a query to a data source

SQL.RETRIEVE.TO.FILE   Retrieves query results and places them in a file

SQL.RETRIEVE   Retrieves query results

SQL.GET.SCHEMA   Gets information about a connected data source.

SQL.CLOSE   Closes a connection to a data source.

SQL.ERROR   Returns detailed error information

Return to index