Help Center

CODBCStmt.GetForeignKeysmethod

Returns list of foreign keys of the table.

DatabasesmethodCODBCStmt.incdocumented

Syntax

FUNCTION GetForeignKeys (BYREF wszPkCatalogName AS WSTRING, BYVAL pkCatalogNameLength AS SQLSMALLINT, BYREF wszPkSchemaName AS WSTRING, BYVAL pkSchemaNameLength AS SQLSMALLINT, BYREF wszPkTableName AS WSTRING, BYVAL pkTableNameLength AS SQLSMALLINT, BYREF wszFkCatalogName AS WSTRING, BYVAL FkCatalogNameLength AS SQLSMALLINT, BYREF wszFkSchemaName AS WSTRING, BYVAL FkSchemaNameLength AS SQLSMALLINT, BYREF wszFkTableName AS WSTRING, BYVAL fkTableNameLength AS SQLSMALLINT) AS SQLRETURN

Parameters

NameDescription
wszPkCatalogNamePrimary key table catalog 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. wszPkCatalogName cannot contain a string search pattern.
CatalogNameLengthLength of wszPkCatalogName.
wszPkSchemaNamePrimary key table schema 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. wszPKSchemaName cannot contain a string search pattern.
PkSchemaNameLengthLength of wszPkSchemaName.
wszPkTableNamePrimary key table name. wszPkTableName cannot contain a string search pattern.
PkTableNameLengthLength of wszPkTableName.
wszFkCatalogNameForeign key table catalog 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. wszFkCatalogName cannot contain a string search pattern.
FkCatalogNameLengthLength of wszFkCatalogName.
wszFkSchemaNameForeign key table schema 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. wszFkSchemaName cannot contain a string search pattern.
FkSchemaNameLengthLength of wszFkSchemaName.
wszFkTableNameForeign key table name. wszFkTableName cannot contain a string search pattern.
FkTableNameLengthLength of wszFkTableName.

Return value

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

Description

GetForeignKeys can return:

  • A list of foreign keys in the specified table (columns in the specified table that refer to primary keys in other tables).
  • A list of foreign keys in other tables that refer to the primary key in the specified table.

Reference

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