Condividi tramite


FromClause (clsColumn)

[!NOTA]

  Questa caratteristica verrà rimossa a partire dalla prossima versione di Microsoft SQL Server. Non utilizzare questa caratteristica in un nuovo progetto di sviluppo e modificare non appena possibile le applicazioni in cui è attualmente implementata.

The FromClause property of an object of ClassType clsColumn specifies the FROM clause of the SQL query that returns a nested table.

[!NOTA]

  This property applies only to columns that belong to mining model objects of SubClassType sbclsRegular.

Data Type

String

Access

Read/write for columns with a SubClassType of sbclsNested, read-only for all others.

Osservazioni

For columns with a SubClassType of sbclsRegular, this property returns the Filter property of the parent object. Columns can be nested, so the parent object can be either a clsMiningModel object or a clsColumn object.

Examples

Creating a New Nested Column

The following code creates a new nested column called Products. It uses the FromClause and JoinClause properties to establish the SQL joins to the parent table. It then creates a new column called CustomerID and establishes that this column contains key values from the parent table by setting the IsParentKey property to TRUE. The clsColumn object that contains the keys in the parent table is referred to by the value of the RelatedColumn property: KeyColumn.

' Create a new nested column.
Set dsoNestedCol = dsoDmm.Columns.AddNew("Products", sbclsNested)
dsoNestedCol.FromClause = """Sales"", ""SalesReps"", ""Products"""
dsoNestedCol.JoinClause = """Sales"".""SalesRep"" = ""SalesReps"".""Name""" & _
    " AND ""Sales"".""Product"" = ""Products"".""Product"""
dsoNestedCol.Filter = ""

' Create a new column that contains key values from the parent table.
Set dsoColumn = dsoNestedCol.Columns.AddNew("CustomerID")
dsoColumn.SourceColumn = """Products"".""CustId"""
dsoColumn.DataType = adInteger
dsoColumn.IsParentKey = True
' The RelatedColumn property is set to the clsColumn object used
' as the key column for the data mining model.
dsoColumn.RelatedColumn = "KeyColumn"

Vedere anche

Riferimento