Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
IsKey (clsColumn)

IsKey (clsColumn)

SQL Server 2000

IsKey (clsColumn)

The IsKey property of an object of ClassType clsColumn indicates whether the column is a key column in the case table or in a nested table.

Data Type



Read/write for columns with a SubClassType of sbclsRegular that belong to a clsMiningModel object with a SubClassType of sbclsRegular, read-only for all others.


A key column is a column that uniquely identifies each row in the case table. There can be more than one key column in a row. For example, to uniquely identify a customer it may be necessary to use both the name column and address column of a customer record as the keys. In a nested table, the key column with a parent key column (using the IsParentKey property) is used to uniquely identify the rows of the nested table and relate them to the case table.

The value of IsKey can vary based on the SubClassType property of the column and the properties of the parent object.

The IsKey property is always False for columns with a SubClassType of sbclsNested. If the parent object is an OLAP mining model (a clsMiningModel object with a SubClassType of sbclsOlap), the IsKey property returns True only if the column is associated with the lowest enabled level of the case dimension (that is, the SourceColumn property of the column matches the CaseLevel property of the parent clsMiningModel object).

Adding a New Column

The following example adds a new column, Customer Id, to the Columns collection of a mining model object. It then sets the IsKey property and other important properties.

' Add a new column to the mining model called Customer Id and relate
' this column to the Name level of the Customers dimension.
' Describe the level's type and make it a key for the model.
' Assume that a DSO level object already exists, called dsoLvl.
    'Add Customer Id as a new column in the model.
    Set dsoColumn = dsoDmm.Columns.AddNew("Customer Id")
    'Identify the level in Sales that this column is based on.
    Set dsoColumn.SourceOlapObject = dsoLvl
    'Identify the type of column this is.
    dsoColumn.DataType = adInteger ' This enumeration is from ADO.
    'Identify this column as a key.
    dsoColumn.IsKey = True
© 2015 Microsoft