SQLColumns

ODBC and SQL Server

ODBC and SQL Server

SQLColumns

SQLColumns executes the Transact-SQL procedure sp_columns to report catalog data for database columns.

The following table shows SQLColumns parameter mapping for sp_columns stored procedure execution.

SQLColumns parameter name sp_columns parameter name
CatalogName object_qualifier
SchemaName object_owner
TableName object_name
ColumnName column_name

SQLColumns returns SQL_SUCCESS whether or not values exist for the CatalogName, TableName, or ColumnName parameters. SQLFetch returns SQL_NO_DATA when invalid values are used in these parameters.

SQLColumns can be executed on a static server cursor. An attempt to execute SQLColumns on an updatable (dynamic or keyset) cursor will return SQL_SUCCESS_WITH_INFO indicating that the cursor type has been changed.

The Microsoft® SQL Server™ ODBC driver supports reporting information for tables on linked servers by accepting a two-part name for the CatalogName parameter: Linked_Server_Name.Catalog_Name.

For ODBC 2.x applications not using wildcards in TableName, SQLColumns returns information about any tables whose names match TableName and are owned by the current user. If the current user owns no table whose name matches the TableName parameter, SQLColumns returns information about any tables owned by other users where the table name matches the TableName parameter. For ODBC 2.x applications using wildcards, SQLColumns returns all tables whose names match TableName. For ODBC 3.x applications SQLColumns returns all tables whose names match TableName regardless of owner or whether wildcards are used.

See Also

sp_columns