Help Center

CODBCStmt.GetPrimaryKeysmethod

Returns the column names that make up the primary key for a table.

DatabasesmethodCODBCStmt.incdocumented

Syntax

FUNCTION GetPrimaryKeys (BYREF wszCatalogName AS WSTRING, BYVAL CatalogNameLength AS SQLSMALLINT, BYREF wszSchemaName AS WSTRING, BYVAL SchemanameLength AS SQLSMALLINT, BYREF wszTableName AS WSTRING, BYVAL TableNameLength AS SQLSMALLINT) AS SQLRETURN

Parameters

NameDescription
wszCatalogNameCatalog name. If a driver supports catalogs for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have catalogs. wszCatalogName cannot contain a string search pattern.
If the SQL_ATTR_METADATA_ID statement attribute is set to SQL_TRUE, wszCatalogName is treated as an identifier and its case is not significant. If it is SQL_FALSE, wszCatalogName is an ordinary argument; it is treated literally, and its case is significant.
CatalogNameLengthLength of wszCatalogName.
wszSchemaNameSchema name. If a driver supports schemas for some tables but not for others, such as when the driver retrieves data from different DBMSs, an empty string ("") denotes those tables that do not have schemas. wszSchemaName cannot contain a string search pattern.
SchemaNameLengthLength of wszSchemaName.
wszTableNameTable name. This argument cannot be a null pointer. wszTableName cannot contain a string search pattern.
TableNameLengthLength of wszTableName.

Return value

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

Description

Returns the column names that make up the primary key for a table. This function does not support returning primary keys from multiple tables in a single call. Optional feature not implemented by the Microsoft Access Driver.

Reference

  • Include file CODBCStmt.inc
  • Defined in AfxNova/COdbcStmt.inc:2013
  • Documented in Databases/ODBC Classes/CODBCStmt Class.md
  • Topic: CODBCStmt Class