Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Template - Type 6 SCD Stored Procedure

By Marie Bayer,

This handy template has template parameters (Query, Specifiy Values for Template Parameters) - use that instead of search and replace.

The template has two merge statements with descriptive comments in brackets.

The Type 6 SCD uses 2 merges:

Type 1 (changes on non-historical fields, deleted source records)

Type 2 (changes on historical fields and new records)

This will make it easier to create the processes as they are here as shells and you won't need to remember the syntax.

Many thanks to Adam Aspin's wonderful article for teaching me about the OUTPUT portion of a MERGE.

Total article views: 2145 | Views in the last 30 days: 6
Related Articles

SSMS and Template Explorer

SSMS Templates


SSIS Package Template

SSIS Package Template


Profiler Template of 2000 to 2005

Conversion of Templates


Using Templates

Templates are one of those really handy tools that most DBAs I know of have either never heard of or...


Templates and teamwork

SQL Server expert David Poole discusses how teams can work together and share templates in Managemen...


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones