Use GetTableSql() Utility Extension to Create T-SQL CREATE TABLE Scripts

gravatar

Paul S. Waters

Often times it is desirable to create SSIS Packages to create tables in a target database from Tables, Dimensions, and Facts modeled in Biml. The Biml representation of the tables can either be from Biml files with no BimlScript, or dynamically generated from BimlScript. In BIDS Helper , this BimlScript works by executing it with other Biml or BimlScript files.

published 10.05.12

last updated 10.05.12


Share

Tags

  • Dimensions
  • Facts
  • Tables
  • T-SQL
  • Utility Extension
                            


<#@ template language="C#" tier="2" #>

<Biml xmlns="http://schemas.varigence.com/biml.xsd">
	<Packages>
		<Package Name="Create Tables" AutoCreateConfigurationsType="None" ConstraintMode="Linear">
			<Tasks>
				<# foreach(var table in RootNode.Tables) {#>
				<ExecuteSQL Name="Create <#=table.Name#>" ConnectionName="<#=table.Connection.Name#>">
					<DirectInput>
						<#=table.GetTableSql()#>	
					</DirectInput>
				</ExecuteSQL>
				<# } #>
				<# foreach(var table in RootNode.Dimensions) {#>
				<ExecuteSQL Name="Create <#=table.Name#>" ConnectionName="<#=table.Connection.Name#>">
					<DirectInput>
						<#=table.GetTableSql()#>	
					</DirectInput>
				</ExecuteSQL>
				<# } #>
				<# foreach(var table in RootNode.Facts) {#>
				<ExecuteSQL Name="Create <#=table.Name#>" ConnectionName="<#=table.Connection.Name#>">
					<DirectInput>
						<#=table.GetTableSql()#>	
					</DirectInput>
				</ExecuteSQL>
				<# } #>
			</Tasks>
		</Package>
	</Packages>
</Biml>
                        
You are not authorized to comment. A verification email has been sent to your email address. Please verify your account.

Comments

There are no comments yet.