SQL Clone
SQLServerCentral is supported by Redgate
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: 2188 | Views in the last 30 days: 0
Related Articles

SSMS and Template Explorer

SSMS Templates


SSIS Package Template

SSIS Package Template


Template Configuration

Extended Events is a much more complex system and profiler, and the use of templates can reduce the ...


Using Templates

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


Profiler Template of 2000 to 2005

Conversion of Templates