<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://sqlblog.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>SSIS Junkie : sql</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql/default.aspx</link><description>Tags: sql</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Debunking Kimball Effective Dates</title><link>http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/28/debunking-kimball-effective-dates.aspx</link><pubDate>Sat, 28 Nov 2009 15:59:00 GMT</pubDate><guid isPermaLink="false">21093a07-8b3d-42db-8cbf-3350fcbf5496:19269</guid><dc:creator>jamiet</dc:creator><slash:comments>56</slash:comments><comments>http://sqlblog.com/blogs/jamie_thomson/comments/19269.aspx</comments><wfw:commentRss>http://sqlblog.com/blogs/jamie_thomson/commentrss.aspx?PostID=19269</wfw:commentRss><wfw:comment>http://sqlblog.com/blogs/jamie_thomson/rsscomments.aspx?PostID=19269</wfw:comment><description>&lt;p&gt;Those who are familiar with Ralph Kimball’s theories on data warehousing modelling may be familiar with his assertion that a type 2 dimension member record should have a StartDate and an EndDate that defines the effective period of that record. He outlines this approach in his paper &lt;a href="http://digital.dmreview.com/dmreview/200810/?pg=21"&gt;Slowly Changing Dimensions, Types 2 &amp;amp; 3&lt;/a&gt; from the &lt;a href="http://digital.dmreview.com/dmreview/200810/?pg=21"&gt;October 2008 edition of DMReview&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;i&gt;I recommend adding five additional fields to a dimension that is undergoing Type 2 processing… begin-effective-datetime &amp;amp; end-effective-datetime are full time stamps that that represent the span of time between when the change became effective and when the next change becomes effective. The end-effective-datetime of a Type 2 dimension record must be exactly equal to the begin-effective-datetime of the next change for that dimension member .The most current dimension record must have an end-effective-datetime equal to a fictitious datetime far in the future.&lt;/i&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;My opinion, which is based on experience of implementing this technique, is that it is a bad idea and in this blog post I’ll explain why. Let me clarify that I do not think the practise of managing dimension members as Type 2 slowly changing dimensions is a bad idea, only that maintaining an effective period using a start date and an end date is.&lt;/p&gt;  &lt;h3&gt;Framing the problem&lt;/h3&gt;  &lt;p&gt;Let’s look at an example where I am modelling customers as a type 2 dimension. Following Kimball’s advice we would implement a table something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_61A8C458.png"&gt;&lt;img style="border-width:0px;margin-right:auto;margin-left:auto;float:none;display:block;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_6970B6FA.png" width="756" height="148"&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Note how we have two records for “Henry” because at some point he got married and had a child (attributes that we treat as type 2 changes) and how the [SCDEndDate] of the first record equals the [SCDStartDate] of the second record.&lt;/p&gt;  &lt;p&gt;Can you spot the obvious problem here? &lt;em&gt;We’ve got the same piece of information in more than one place&lt;/em&gt;; namely the date ‘27/11/2009’. What’s the point? We know that the [SCDEndDate] of a record equals the [SCDStartDate] of the record that supersedes it so using our old friend SQL we can easily work out the [SCDEndDate] of any record. I’ve seen too many examples of Kimball’s approach being used and I’ve hardly ever seen it not be a problem; just recently I worked on a data migration project and we had untold problems created by the use of [SCDStartDate] and [SCDEndDate] because the database could not constrain this relationship and neither, seemingly, did the code that had been written to manage the data.&lt;/p&gt;  &lt;p&gt;At the root of this problem is the fact that Kimball’s method cannot be constrained in a relational database management system (RDBMS) without a complicated and debilitating set-based check constraint, it ignores the goodness of relational theory and normalisation that data professionals have had drummed into them for years.&lt;/p&gt;  &lt;h3&gt;A better way&lt;/h3&gt;  &lt;p&gt;Here follows how I would solve this problem; note that the syntax here is for SQL Server but this method would work perfectly well for any RDBMS.&lt;/p&gt;  &lt;p&gt;Firstly, let’s create a table and put some data in it:&lt;/p&gt;  &lt;blockquote&gt;   &lt;table cellSpacing="0" cellPadding="0" bgColor="#eeeeee"&gt;       &lt;tr&gt;         &lt;td&gt;           &lt;pre style="padding:10px 20px;font-family:consolas,lucida console,courier new,courier;font-size:12px;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE TABLE &lt;/font&gt;&lt;font color="black"&gt;[Customer] &lt;/font&gt;&lt;font color="gray"&gt;(
&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Id]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;INT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; PRIMARY KEY
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[NId]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;50&lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Name]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;50&lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[HomeTown]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;NVARCHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;50&lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[MaritalStatus]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;CHAR&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;1&lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[NumberOfChildren]&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;INT
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[SCDStartDate]&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DATETIME&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="green"&gt;--Note only [SCDStartDate], no [SCDEndDate]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;CONSTRAINT&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;Customer_UK &lt;/font&gt;&lt;font color="blue"&gt;UNIQUE
&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;(
&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[NId]
&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[SCDStartDate]
&lt;br&gt;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;);
&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;INSERT &lt;/font&gt;&lt;font color="black"&gt;[Customer] &lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;[Id]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[NId]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[Name]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[HomeTown]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[MaritalStatus]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[NumberOfChildren]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;[SCDStartDate]&lt;/font&gt;&lt;font color="gray"&gt;)
&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;VALUES &lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;1&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Cust001'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Henry'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'London'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'S'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;0&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'20050324'&lt;/font&gt;&lt;font color="gray"&gt;))
&lt;br&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/font&gt;&lt;font color="black"&gt;2&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Cust001'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Henry'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'London'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'M'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;0&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'20070726'&lt;/font&gt;&lt;font color="gray"&gt;))
&lt;br&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/font&gt;&lt;font color="black"&gt;3&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Cust002'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Sarah'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Birmingham'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'M'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;2&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'20060213'&lt;/font&gt;&lt;font color="gray"&gt;))
&lt;br&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;/font&gt;&lt;font color="black"&gt;4&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Cust001'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'Henry'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'London'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'M'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;1&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'20091127'&lt;/font&gt;&lt;font color="gray"&gt;));,&lt;/font&gt;&lt;font color="red"&gt;'M'&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;2&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'20060213'&lt;/font&gt;&lt;font color="gray"&gt;));&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;I’ve created three rows here for Henry for demo purposes. Over time we notice that Henry got married and then later had a child; note that there is no [SCDEndDate]:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_14D4D7F5.png"&gt;&lt;img style="border-width:0px;display:inline;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_535A259B.png" width="571" height="162"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now let’s write a view that gets us the [SCDEndDate] for each record:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;table cellSpacing="0" cellPadding="0" bgColor="#eeeeee"&gt;
      &lt;tr&gt;
        &lt;td&gt;
          &lt;pre style="padding:10px 20px;font-family:consolas,lucida console,courier new,courier;font-size:12px;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;&lt;font color="blue"&gt;CREATE VIEW &lt;/font&gt;&lt;font color="black"&gt;vCustomer&amp;nbsp; &lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;AS
&lt;br&gt;SELECT &lt;/font&gt;&lt;font color="black"&gt;c.[Id]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[NId]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[Name]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[HomeTown]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[MaritalStatus]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;c.[NumberOfChildren]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[SCDStartDate]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="magenta"&gt;COALESCE&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="blue"&gt;MIN&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;c2.[ScdStartDate]&lt;/font&gt;&lt;font color="gray"&gt;),&lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;DATETIME&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="red"&gt;'99991231'&lt;/font&gt;&lt;font color="gray"&gt;)) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;[SCDEndDate]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="magenta"&gt;CONVERT&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;BIT&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="magenta"&gt;CASE&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="blue"&gt;WHEN MIN&lt;/font&gt;&lt;font color="gray"&gt;(&lt;/font&gt;&lt;font color="black"&gt;c2.[ScdStartDate]&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;IS &lt;/font&gt;&lt;font color="gray"&gt;NULL &lt;/font&gt;&lt;font color="blue"&gt;THEN &lt;/font&gt;&lt;font color="black"&gt;1 &lt;/font&gt;&lt;font color="blue"&gt;ELSE &lt;/font&gt;&lt;font color="black"&gt;0 &lt;/font&gt;&lt;font color="blue"&gt;END&lt;/font&gt;&lt;font color="gray"&gt;) &lt;/font&gt;&lt;font color="blue"&gt;AS &lt;/font&gt;&lt;font color="black"&gt;[IsLatest]
&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;FROM&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;[Customer] c
&lt;br&gt;&lt;/font&gt;&lt;font color="magenta"&gt;LEFT&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="gray"&gt;OUTER &lt;/font&gt;&lt;font color="blue"&gt;JOIN &lt;/font&gt;&lt;font color="black"&gt;[Customer] c2
&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;ON&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;c.[Nid] &lt;/font&gt;&lt;font color="blue"&gt;= &lt;/font&gt;&lt;font color="black"&gt;c2.[Nid]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;AND&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;c.[SCDStartDate] &lt;/font&gt;&lt;font color="gray"&gt;&amp;lt; &lt;/font&gt;&lt;font color="black"&gt;c2.[SCDStartDate]
&lt;br&gt;&lt;/font&gt;&lt;font color="blue"&gt;GROUP&amp;nbsp; BY &lt;/font&gt;&lt;font color="black"&gt;c.[Id]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[NId]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[Name]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[HomeTown]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[MaritalStatus]
&lt;br&gt;&lt;/font&gt;&lt;font color="gray"&gt;,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;font color="black"&gt;c.[NumberOfChildren]&lt;/font&gt;&lt;font color="gray"&gt;,&lt;/font&gt;&lt;font color="black"&gt;c.[SCDStartDate]&lt;/font&gt;&lt;font color="gray"&gt;;&lt;/font&gt;&lt;/pre&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here is what we get if we select from that view:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;a href="http://sqlblog.com/blogs/jamie_thomson/image_3FCCC5FA.png"&gt;&lt;img style="border-width:0px;display:inline;" title="image" border="0" alt="image" src="http://sqlblog.com/blogs/jamie_thomson/image_thumb_765A713E.png" width="748" height="144"&gt;&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Note that each row for Henry has an [SCDEndDate] that is &lt;em&gt;guaranteed&lt;/em&gt; to be the same as the [SCDStartDate] of the record that supersedes it. Note also that we are &lt;em&gt;guaranteed&lt;/em&gt; there will be no time period gaps since when Henry first became known to us. (Edit: Another advantage of this approach was pointed out to me by Phil Nolan in the comments below: we do not have to update a record when it gets superseded which we would have to do were we explicitly storing [SCDEndDate])&lt;/p&gt;

&lt;p&gt;We have achieved this by joining the [Customer] table to itself and, for each row, finding the row that supersedes it and use the superseding row’s [SCDStartDate] as the current row’s [SCDEndDate]; if there is no superseding row we simply use a fictitious future date exactly as Kimball suggests. Moreover we can also derive an [IsLatest] field which is another field that Kimball recommend we use and also another field whose value cannot be constrained by the relational model. We have achieved the same as Kimball’s bunkum [SCDStartDate] &amp;amp; [SCDEndDate] table columns and still maintained the integrity of our data.&lt;/p&gt;

&lt;p&gt;The counter argument to doing this is that Kimball’s method will be quicker because we don’t need to write an INNER JOIN to achieve the data that we want. Well that is true but ask yourself what is more important, querying speed or the integrity of your data? If your answer is '’querying speed’ then you should probably ask yourself why you’re bothering to use an RDBMS at all; data integrity is the reason that we build a relational data model. [That’s a pretty controversial opinion so I’ll look forward to debating it in the &lt;a href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/28/debunking-kimball-effective-dates.aspx"&gt;comments of this blog post&lt;/a&gt; :)]&lt;/p&gt;

&lt;p&gt;If you absolutely need the [SCDEndDate] persisted somewhere then I’ll concede that the view resultset can be materialised into a table but really I don’t think there is that much need to do so; the main use of an [SCDEndDate] is to make your ETL easier and I’m sure its extremely rare that an ETL process cannot cope with the slightly increased querying time created by using the method I outline herein.&lt;/p&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;In this blog post I have outlined the problems that I believe are inherent in Kimball’s method of defining a time period for a slowly-changing-dimension record and also an alternative method that exhibits a purer method of achieving the same information. I welcome your thoughts in the comments below.&lt;/p&gt;

&lt;p&gt;I have uploaded the script that I used herein so that you can try this technique for yourself. Download it from my Skydrive: &lt;a title="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091128/DebunkingKimballMethodEffectiveDates.sql" href="http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091128/DebunkingKimballMethodEffectiveDates.sql"&gt;http://cid-550f681dad532637.skydrive.live.com/self.aspx/Public/BlogShare/20091128/DebunkingKimballMethodEffectiveDates.sql&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://twitter.com/jamiet"&gt;@Jamiet&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;P.S. There are some great debates going on in the comments section of this blog post so if you’re reading this using a blog aggregator/feedreader click through to &lt;a title="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/28/debunking-kimball-effective-dates.aspx" href="http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/28/debunking-kimball-effective-dates.aspx"&gt;http://sqlblog.com/blogs/jamie_thomson/archive/2009/11/28/debunking-kimball-effective-dates.aspx&lt;/a&gt; to read more opinions on this.&lt;/p&gt;&lt;p&gt;&lt;span style="text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;white-space:normal;orphans:2;widows:2;font-size-adjust:none;font-stretch:normal;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;"&gt;UPDATE: The debate continued over on &lt;a href="http://forum.kimballgroup.com/t1771-did-anybody-read-this-article" target="_blank"&gt;KimballGroup.com&lt;/a&gt; (where all&amp;nbsp;respondents&lt;/span&gt;&lt;span style="text-transform:none;text-indent:0px;letter-spacing:normal;word-spacing:0px;float:none;white-space:normal;orphans:2;widows:2;font-size-adjust:none;font-stretch:normal;-webkit-text-size-adjust:auto;-webkit-text-stroke-width:0px;"&gt;&amp;nbsp;disagreed with me, unsurprisingly).&lt;/span&gt;&lt;/p&gt;&lt;img src="http://sqlblog.com/aggbug.aspx?PostID=19269" width="1" height="1"&gt;</description><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/data+modelling/default.aspx">data modelling</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/data+warehousing/default.aspx">data warehousing</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/Kimball/default.aspx">Kimball</category><category domain="http://sqlblog.com/blogs/jamie_thomson/archive/tags/sql/default.aspx">sql</category></item></channel></rss>