Saturday, September 15, 2012

BIML Schema’s and Tables

If you find a BIML on Tables sample on the internet looking like this one: you might run into trouble getting it to work in BIDS 1.6.1.
This is caused because the BIML xsd has undergone some changes. At this moment (September 2012) the good people of Varigence haven’t had the time to update the documentation on their site.
With the help of Scott Currie  of Varigence I got the sample to work.
<Biml xmlns="">
            File: Tables.biml
            Demo biml file on how to create tables
                using BIML from the 1.6.1 BIDS Helper
            DB: MS-SQL2012
            BIML: 1.6 VS2010 BIDS Helper
            (c) John Minkjan
                ConnectionString="Data Source=.\MSSQL2012;Initial Catalog=AdventureWorks2012;Provider=SQLNCLI10.1;Integrated Security=SSPI;Connect Timeout=30;"/>
        <Database Name="AdventureWorks2012"
                  ConnectionName="CnOleDBAdventureWorks2012" />
        <Schema Name ="Test" DatabaseName="AdventureWorks2012"
        <Table Name="DimAccount_Test" SchemaName="AdventureWorks2012.Test"
               CompressionType="Page" >
            <!--Attn:    Schema requires DatabaseName.SchemaName
                        If you haven't got a schema defined use
                <Column Name="AccountKey" />
                <Column Name="ParentAccountKey"
                        IsNullable="true" />
                <Column Name="AccountCodeAlternateKey"
                        IsNullable="true" />
                <Column Name="ParentAccountCodeAlternateKey"
                        IsNullable="true" />
                <!--Attn:    If you don't define a DataType the column will
                            be defined as int  -->
                <Column Name="AccountDescription"
                        DataType="String" Length="50"
                        IsNullable="true" />
                <Column Name="AccountType"
                        DataType="String" Length="50" IsNullable="true" />
                <Column Name="Operator"
                        DataType="String" Length="50" IsNullable="true" />
                <Column Name="CustomMembers"
                        DataType="String" Length="300" IsNullable="true" />
                <Column Name="ValueType"
                        DataType="String" Length="50" IsNullable="true" />
                <Column Name="CustomMemberOptions"
                        DataType="String" Length="200" IsNullable="true" />
The package create block looks like this:
<#@ template language="C#" hostspecific="True" #>
<Biml xmlns="">
        <Package Name="Create Tables" AutoCreateConfigurationsType="None" ConstraintMode="Linear">
                <# foreach(var table in RootNode.Tables) {#>
                <ExecuteSQL Name="Create <#=table.Name#>" ConnectionName="<#=table.Connection.Name#>">
                <# } #>                   
Till Next Time

1 comment:

  1. Thank you so much, thought I was losing my mind seeing all the older examples and expecting mine to match!