SourceColumn (clsColumn)
注意: |
---|
下一版本的 Microsoft SQL Server 将删除该功能。请不要在新的开发工作中使用该功能,并尽快修改当前还在使用该功能的应用程序。 |
The SourceColumn property of an object of ClassType clsColumn identifies the name of its source column in a relational table. This property applies only to columns belonging to mining model objects of SubClassType sbclsRegular.
Data Type
String
Access
Read/write for columns with a SubClassType of sbclsRegular, read-only for all others.
备注
For columns with a SubClassType of sbclsNested that belong to a mining model object of SubClassType of sbclsRegular, this property returns an empty string.
To understand the function of this property, consider the relationships of columns in a model to an SQL query. If you use a SELECT query to define the structure of a table when you create a mining model, the contents of this property for each column in the model correspond to a column designation within the SELECT query. For example, consider the following query:
SELECT "Key" AS "CustId", "Age" AS "Age" FROM "People"
If a mining model were to be created using this SELECT statement, the SourceColumn properties for each column would be "Key" and "Age" respectively.
Examples
Creating a Data Mining Model
The following example creates a data mining model based upon the People table of a relational database. This table is specified by the FromClause property. Because the model is based upon a single table, no joins are needed. It then creates and adds two columns to the model's Columns collection. Each column is related to a field in the original relational table (that is to say, the People table) by setting the SourceColumn property of each column to the appropriate value.
dsoDmm.Description = "Analyzes the purchasing behavior of customers"
dsoDmm.MiningAlgorithm = "Microsoft_Decision_Trees"
dsoDmm.FromClause = "People"
dsoDmm.JoinClause = "" ' None is needed because there is only a single table.
dsoDmm.Filter = ""
dsoDmm.TrainingQuery = "" 'Let DSO figure out the training query.
Set dsoColumn = dsoDmm.Columns.AddNew("CustId")
dsoColumn.SourceColumn = "People.Key"
dsoColumn.DataType = adInteger
dsoColumn.IsKey = True
Set dsoColumn = dsoDmm.Columns.AddNew("Age")
dsoColumn.SourceColumn = "People.Age"
dsoColumn.DataType = adDouble
dsoColumn.ContentType = "CONTINUOUS"