EnumDependencies Method (SQL-DMO)

The EnumDependencies method returns a QueryResults object enumerating Microsoft® SQL Server™ database user objects and user object dependency relationships.

Applies To
Database Object Table Object
DBObject Object Trigger Object
ReplicationStoredProcedure Object View Object
StoredProcedure Object  

Syntax

object.EnumDependencies( [ DependencyType ] ) as QueryResults

Part Description
object Expression that evaluates to an object in the Applies To list
DependencyType Long integer directing output as described in Settings

Settings
Constant Value Description
SQLDMODep_Children 262144 Lists all components that depend on the referenced SQL Server component.
SQLDMODep_DRIOnly 2097152 Lists components that depend on the referenced SQL Server component in a DRI relationship.
SQLDMODep_FirstLevelOnly 1048576 Lists only immediate parents. Combine with SQLDMODep_Children to list only immediate children.
SQLDMODep_FullHierarchy 65536 Alters the default result set describing hierarchy relationship in a result set row.
SQLDMODep_OrderDescending 131072 Applies descending order to returned list.
SQLDMODep_Parents 0 Lists all objects on which the referenced SQL Server component depends.
SQLDMODep_ReturnInputObject 524288 Includes SQL Server component referenced by the SQL-DMO object in the list returned.
SQLDMODep_Valid 4128768 All dependency constants combined by using an Or.

Returns

A QueryResults object containing up to three result sets. When no user-defined data types, defaults, or rules are contained in the dependency tree, a single result set is returned, defined by these columns.

Column Data type Description
oType integer Database object type, enumerated by SQLDMO_OBJECT_TYPE.
oObjName nvarchar(129) Database object name.
oOwner nvarchar(129) Database object owner name.
RelType integer Displayed when SQLDMODep_FullHierarchy is specified. When the RelName value is nonNULL, RelType is the hierarchically related database object type, enumerated by SQLDMO_OBJECT_TYPE. When RelName value is NULL, the value 0 is returned and can be ignored.
RelName nvarchar(129) Displayed when SQLDMODep_FullHierarchy is specified. Hierarchically-related database object name.
RelOwner nvarchar(129) Displayed when SQLDMODep_FullHierarchy is specified. Hierarchically-related database object owner name.
oSequence smallint Indicator of distance in the hierarchy between the specified object and the object listed.

When the dependency tree contains defaults, rules, or user-defined data types, one or two additional result sets are returned by the EnumDependencies method. When rules or defaults are contained, a result set is returned, defined by these columns.

Column Data type Description
oType integer Database object type, enumerated by SQLDMO_OBJECT_TYPE. Value is SQLDMOObj_Default or SQLDMOObj_Rule for all rows.
oRuleDefName nvarchar(129) Database object name.
oOwner nvarchar(129) Database object owner name.
oSequence smallint Indicator of distance in the hierarchy between the specified object and the object listed.

When user-defined data types are contained in the dependency tree, a result set enumerating the data types is returned. The user-defined data type result set is defined by these columns.

Column Data type Description
oType integer Database object type, enumerated by SQLDMO_OBJECT_TYPE. Value is SQLDMOObj_UserDefinedDatatype for all rows.
oUDDTName nvarchar(129) User-defined data type name.
oOwner nvarchar(129) User-defined data type owner name.
oSequence smallint Indicator of distance in the hierarchy between the specified object and the object listed.

Prototype (C/C++)

HRESULT EnumDependencies(
LPSQLDMOQUERYRESULTS* ppResults,
SQLDMO_DEPENDENCY_TYPE DependencyType = SQLDMODep_Parents);

  


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