适用于: SQL Server 2016 Preview
在本课程中,您将使用 INSERT INTO 语句和 vTargetMail 视图从 AdventureWorksDW2012 可处理的挖掘结构和挖掘模型中创建示例数据库 第 1 课︰ 创建自行车购买者挖掘结构 和 第 2 课︰ 向自行车购买者挖掘结构添加挖掘模型。
处理挖掘结构时,Analysis Services 将读取源数据并生成支持挖掘模型的结构。 处理挖掘模型时,挖掘结构定义的数据将通过所选择的数据挖掘算法进行传递。 该算法将搜索趋势和模式,然后在挖掘模型中存储此信息。 因此,挖掘模型不包含实际源数据,而是包含由算法发现的信息。 有关处理挖掘模型的详细信息,请参阅 处理要求和注意事项和 #40; 数据挖掘 )。
仅在更改了结构列或源数据的情况下,才需要重新处理挖掘结构。 如果将挖掘模型添加到已处理的挖掘结构中,则可使用 INSERT INTO MINING MODEL 语句定型新的挖掘模型。
定型结构模板
为了定型挖掘结构及其关联的挖掘模型,请使用 INSERT INTO #40; DMX ) 语句。 可以将语句中的代码分为下列几部分:
- 标识挖掘结构 
- 列出挖掘结构中的列 
- 定义定型数据 
下面是 INSERT INTO 语句的一般示例:
INSERT INTO MINING STRUCTURE [<mining structure name>]  
(  
   <mining structure columns>  
)  
OPENQUERY([<datasource>],'<SELECT statement>')  
代码的第一行标识将定型的挖掘结构:
INSERT INTO MINING STRUCTURE [<mining structure name>]  
代码的第二行指定由挖掘结构定义的列。 必须列出挖掘结构的每一列,并且每列必须映射到源查询数据所包含的对应列。
(  
   <mining structure columns>  
)  
代码的最后一行定义将用于定型挖掘结构的数据:
OPENQUERY([<datasource>],'<SELECT statement>')  
在本课程中,您将使用 OPENQUERY 来定义源数据。 定义源查询的其他方法的信息,请参阅 < 源数据查询 >。
课程任务
在本课程中,将执行以下任务︰
- 处理自行车购买者挖掘结构
处理预测性挖掘结构
使用 INSERT INTO 处理挖掘结构
- 在 对象资源管理器, ,用鼠标右键单击实例 Analysis Services, ,指向 新查询, ,然后单击 DMX。 - 将打开查询编辑器,其中包含一个新的空白查询。 
- 将 INSERT INTO 语句的一般示例复制到空白查询中。 
- 将 - [<mining structure name>]- 使用︰ - Bike Buyer
- 将 - <mining structure columns>- 使用︰ - [Customer Key], [Age], [Bike Buyer], [Commute Distance], [Education], [Gender], [House Owner Flag], [Marital Status], [Number Cars Owned], [Number Children At Home], [Occupation], [Region], [Total Children], [Yearly Income]
- 将 - OPENQUERY([<datasource>],'<SELECT statement>')- 使用︰ - OPENQUERY([Adventure Works DW], 'SELECT CustomerKey, Age, BikeBuyer, CommuteDistance,EnglishEducation, Gender,HouseOwnerFlag,MaritalStatus, NumberCarsOwned,NumberChildrenAtHome, EnglishOccupation,Region,TotalChildren, YearlyIncome FROM dbo.vTargetMail')- OPENQUERY 语句将引用 Adventure Works DW Multidimensional 2012 数据源,以访问 vTargetMail 视图。 该视图包含将用于定型挖掘模型的源数据。 - 现在,完整的语句应该如下所示: - INSERT INTO MINING STRUCTURE [Bike Buyer] ( [Customer Key], [Age], [Bike Buyer], [Commute Distance], [Education], [Gender], [House Owner Flag], [Marital Status], [Number Cars Owned], [Number Children At Home], [Occupation], [Region], [Total Children], [Yearly Income] ) OPENQUERY([Adventure Works DW], 'SELECT CustomerKey, Age, BikeBuyer, CommuteDistance,EnglishEducation, Gender,HouseOwnerFlag,MaritalStatus, NumberCarsOwned,NumberChildrenAtHome, EnglishOccupation,Region,TotalChildren, YearlyIncome FROM dbo.vTargetMail')
- 在 文件 菜单上,单击 dmxquery1.dmx 另存为。 
- 在 另存为 对话框中,浏览到相应的文件夹,并将文件 Process Bike Buyer Structure.dmx。 
- 在工具栏上,单击 Execute 按钮。 
在下一课中,您将浏览在本课中向挖掘结构添加的挖掘模型中的内容。