Returns information about the structure of the data source on a particular connection. The return value from a successful call to SQL.GET.SCHEMA depends on the type of information that was requested. A list of the accepted requests and their respective return values is listed in the syntax section below.
If this function is not available, you must install the Microsoft ODBC add-in (XLODBC.XLA).
Syntax
SQL.GET.SCHEMA(connection_num, type_num, qualifier_text)
Connection_num is the unique connection ID of the data source you want information about.
Connection_num is returned by a previously executed SQL.OPEN function.
If connection_num is not valid, SQL.GET.SCHEMA returns the #VALUE! error value.
Type_num specifies the type of information you want returned. The following is a list of valid type_num values.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Qualifier_text is only included for type_num values of 3, 4 and 5. It is a text string used to qualify the search for the requested information and should be enclosed by quotation marks.
|
|
|
|
|
|
|
|
Remarks
If SQL.GET.SCHEMA is unable to find the requested information then it will return the error value #N/A. In such a case SQL.GET.SCHEMA will place error information in memory for the SQL.ERROR function, if such information is available.
SQL.GET.SCHEMA works with the ODBC functions SQLGetInfo and SQLTables to find the requested information. Refer to the Microsoft Excel ODBC Programmer Guide for more information on these two functions.
Example
SQL.GET.SCHEMA(conn1,7) returns the name of the current database.
SQL.GET.SCHEMA(conn1,9) returns the name of the DBMS used by the data source.
Related Functions
SQL.OPEN Establishes a connection with a data source
SQL.EXEC.QUERY Sends a query to a data source
SQL.BIND Specifies storage for a result column
SQL.RETRIEVE.TO.FILE Retrieves query results and places them in a file
SQL.RETRIEVE Retrieves query results
SQL.CLOSE Closes a data source connection
SQL.ERROR Returns detailed error information
Return to index