IsValidKeyDatatype Method (SQL-DMO)

The IsValidKeyDatatype method returns True when the data type specified can participate in a PRIMARY KEY or FOREIGN KEY constraint.

Applies To

Database Object

Syntax

object.IsValidKeyDatatype( Type , [ ReferencingType ] )

Part Description
object Expression that evaluates to an object in the Applies To list.
Type String identifying a single base or user-defined data type by name.
ReferencingType Optional. A string identifying a second base or user-defined data type by name.

Returns

True or False as described in Remarks.

Remarks

When only the Type argument is used, the IsValidKeyDatatype method returns True when a column defined using the data type can participate in a PRIMARY KEY constraint.

When a second data type is specified in the ReferencingType argument, the IsValidKeyDatatype method returns True when the types are compatible. A True return value indicates that a column defined using one data type could reference a column defined using the other data type in a FOREIGN KEY constraint.

Prototype (C/C++)

HRESULT IsValidKeyDatatype(
SQLDMO_LPCSTR szKeyColType,
LPBOOL pRetVal,
SQLDMO_LPCSTR szReferencingColType = NULL);

  


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