Skip to content

Instantly share code, notes, and snippets.

View in2bi's full-sized avatar

Marco Schreuder in2bi

View GitHub Profile
@in2bi
in2bi / TruncateAllTables
Last active August 29, 2015 14:04
TSQL Script to truncate all tables in a database
/*
Truncate all tables in a database, by:
- dropping all foreign key constraints
- truncating all the tables
- recreating the dropped foreign key constraints
*/
DECLARE @DropConstraints nvarchar(max)
DECLARE @TruncateTables nvarchar(max)
DECLARE @RecreateConstraints nvarchar(max)
@in2bi
in2bi / SaveCompiledBiml
Created July 28, 2014 09:50
BIML Code to save the compiled BIML to file
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<#
string xBiml = RootNode.GetBiml();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(xBiml);
string sFile = @"C:\temp\myBimlFile.xml";
xmlDoc.Save(sFile);
#>
</Biml>
@in2bi
in2bi / CdcAndBimlPreparation
Created December 3, 2014 10:37
CDC and BIML Preparation of Database
--1. Create database
CREATE DATABASE CDCTest;
GO
--2. Create CDC table using AdventureWorksDW2012 database
USE CDCTest
GO
SELECT *
INTO DimDepartmentGroup_CDC
@in2bi
in2bi / CdcAndBimlInitialLoad
Last active August 29, 2015 14:10
Biml file to creat initial load of CDC enabled table
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<AdoNetConnection Name="Source"
ConnectionString="Data Source=.;Initial Catalog=CDCTest;Integrated Security=True;"
Provider="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
CreateInProject="true" />
<AdoNetConnection Name="Destination"
ConnectionString="Data Source=.;Initial Catalog=CDCTest;Integrated Security=True;"
Provider="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
CreateInProject="true"/>
@in2bi
in2bi / CdcAndBimlIncrementalLoad
Last active July 4, 2016 03:47
Biml file toe create Incremental load
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<Connections>
<AdoNetConnection Name="Source"
ConnectionString="Data Source=.;Initial Catalog=CDCTest;Integrated Security=True;"
Provider="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
CreateInProject="true"
/>
<AdoNetConnection Name="Destination"
ConnectionString="Data Source=.;Initial Catalog=CDCTest;Integrated Security=True;"
Provider="System.Data.SqlClient.SqlConnection, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"