EnumReferencedKeys Method (SQL-DMO)

The EnumReferencedKeys method returns a QueryResults object enumerating the PRIMARY KEY and UNIQUE constraints.

Applies To

Table Object

Syntax

object.EnumReferencedKeys( [ ReferencedTable ] , [ IncludeAll ] )
as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list
ReferencedTable Optional. String naming an existing Microsoft® SQL Server™ table. Restricts result set membership to list only references to objects defined on the specified table.
IncludeAll True or False.

Returns

A QueryResults object containing one result set defined by these columns.

Column Data type Description
candidate_table nvarchar(262) Name of a table on which a PRIMARY KEY or UNIQUE constraint is defined
candidate_key nvarchar(129) Name of a PRIMARY KEY or UNIQUE constraint
referenced bit When 1, the table depends on the PRIMARY KEY or UNIQUE constraint listed in the result set

Remarks

When IncludeAll is True, the result set enumerates all PRIMARY KEY and UNIQUE constraints defined in the database. The value of the result set column referenced determines table object dependency on the listed PRIMARY KEY or UNIQUE constraint.

When IncludeAll is False (default), the result set enumerates only those PRIMARY KEY or UNIQUE constraints on which the table depends.

Prototype (C/C++)

HRESULT EnumReferencedKeys(
LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_LPCSTR ReferencedTableName = NULL,
BOOL IncludeAllCandidates = NULL);

  


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