Export (0) Print
Expand All


Topic Status: Some information in this topic is preview and subject to change in future releases. Preview information describes new features or changes to existing features in Microsoft SQL Server 2016 Community Technology Preview 2 (CTP2).

Combines queries from multiple data sources into a single hierarchical table (that is, a table with nested tables), which becomes the case table for the mining model.

The complete syntax of the SHAPE command is documented in the Microsoft Data Access Components (MDAC) Software Development Kit (SDK).

SHAPE {<master query>}
APPEND ({ <child table query> } 
     RELATE <master column> TO <child column>) 
          AS <column table name>
     ({ <child table query> } 
     RELATE <master column> TO <child column>) 
          AS < column table name>

master query

The query returning the parent table.

child table query

The query returning the nested table.

master column

The column in the parent table to identify child rows from the result of a child table query.

child column

The column in the child table to identify the parent row from the result of a master query.

column table name

The newly appended column name in the parent table for the nested table.

You must order the queries by the column that relates the parent table and child table.

You can use the following example within an INSERT INTO (DMX) statement to train a model containing a nested table. The two tables within the SHAPE statement are related through the OrderNumber column.

    OPENQUERY([Adventure Works DW Multidimensional 2012],'SELECT OrderNumber
    FROM vAssocSeqOrders ORDER BY OrderNumber')
    {OPENQUERY([Adventure Works DW Multidimensional 2012],'SELECT OrderNumber, model FROM 
    dbo.vAssocSeqLineItems ORDER BY OrderNumber, Model')}
  RELATE OrderNumber to OrderNumber) 
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2015 Microsoft