SQLForeignKeys (ODBC)

SQLForeignKeys uses the catalog stored procedure sp_fkeys to report foreign keys referencing a table’s primary key or columns in a table that reference the primary key columns of other tables.

The following table shows the SQLForeignKeys parameter mapping for sp_fkeys stored procedure execution.

SQLForeignKeys parameter name sp_fkeys parameter name
PKTableCatalog pktable_qualifier
PKTableSchema pktable_owner
PKTableName pktable_name
FKTableCatalog fktable_qualifier
FKTableSchema fktable_owner
FKTableName fktable_name

Microsoft® SQL Server™ supports only reference of foreign key values; cascading updates and deletes are not supported through the foreign key constraint mechanism. SQL Server returns SQL_NO_ACTION for the UPDATE_RULE and DELETE_RULE columns of the SQLForeignKeys result set.

When invalid values are present in any SQLForeignKeys parameter, SQLForeignKeys returns SQL_SUCCESS on execution. SQLFetch returns SQL_NO_DATA when invalid values are used in these parameters.

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

The SQL Server ODBC driver supports reporting information for tables on linked servers by accepting a two-part name for the FKCatalogName and PKCatalogName parameters: Linked_Server_Name.Catalog_Name

See Also

sp_fkeys

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.