SQLColumnPrivileges returns the results as a standard result set, ordered by TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, and PRIVILEGE.
Note |
|---|
| SQLColumnPrivileges might not return privileges for all columns. For example, a driver might not return information about privileges for pseudo-columns, such as Oracle ROWID. Applications can use any valid column, regardless of whether it is returned by SQLColumnPrivileges. |
The lengths of VARCHAR columns are not shown in the table; the actual lengths depend on the data source. To determine the actual lengths of the CATALOG_NAME, SCHEMA_NAME, TABLE_NAME, and COLUMN_NAME columns, an application can call SQLGetInfo with the SQL_MAX_CATALOG_NAME_LEN, SQL_MAX_SCHEMA_NAME_LEN, SQL_MAX_TABLE_NAME_LEN, and SQL_MAX_COLUMN_NAME_LEN options.
Note |
|---|
| For more information about the general use, arguments, and returned data of ODBC catalog functions, see Catalog Functions. |
The following columns have been renamed for ODBC 3.x. The column name changes do not affect backward compatibility because applications bind by column number.
|
ODBC 2.0 column
|
ODBC 3.x column
|
| TABLE_QUALIFIER | TABLE_CAT |
| TABLE_OWNER | TABLE_SCHEM |
The following table lists the columns in the result set. Additional columns beyond column 8 (IS_GRANTABLE) can be defined by the driver. An application should gain access to driver-specific columns by counting down from the end of the result set rather than specifying an explicit ordinal position. For more information, see Data Returned by Catalog Functions.
|
Column name
|
Column number
|
Data type
|
Comments
|
| TABLE_CAT (ODBC 1.0) | 1 | Varchar | Catalog identifier; NULL if not applicable to the data source. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have catalogs. |
| TABLE_SCHEM (ODBC 1.0) | 2 | Varchar | Schema identifier; NULL if not applicable to the data source. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, it returns an empty string ("") for those tables that do not have schemas. |
| TABLE_NAME (ODBC 1.0) | 3 | Varchar not NULL | Table identifier. |
| COLUMN_NAME (ODBC 1.0) | 4 | Varchar not NULL | Column name. The driver returns an empty string for a column that does not have a name. |
| GRANTOR (ODBC 1.0) | 5 | Varchar | Name of the user who granted the privilege; NULL if not applicable to the data source. For all rows in which the value in the GRANTEE column is the owner of the object, the GRANTOR column will be "_SYSTEM". |
| GRANTEE (ODBC 1.0) | 6 | Varchar not NULL | Name of the user to whom the privilege was granted. |
| PRIVILEGE (ODBC 1.0) | 7 | Varchar not NULL | Identifies the column privilege. May be one of the following (or others supported by the data source when implementation-defined): SELECT: The grantee is permitted to retrieve data for the column. INSERT: The grantee is permitted to provide data for the column in new rows that are inserted into the associated table. UPDATE: The grantee is permitted to update data in the column. REFERENCES: The grantee is permitted to refer to the column within a constraint (for example, a unique, referential, or table check constraint). |
| IS_GRANTABLE (ODBC 1.0) | 8 | Varchar | Indicates whether the grantee is permitted to grant the privilege to other users; "YES", "NO", or "NULL" if unknown or not applicable to the data source. A privilege is either grantable or not grantable, but not both. The result set returned by SQLColumnPrivileges will never contain two rows for which all columns except the IS_GRANTABLE column contain the same value. |