﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss content posted by patilds / Article Discussions / Article Discussions by Author  / Create and Populate Time Dimension  / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 20:33:17 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Hello,everthing works fine after i edited the isHoliday column :-)Nice script!</description><pubDate>Thu, 29 Oct 2009 04:24:21 GMT</pubDate><dc:creator>suedman</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Thanks for the code - nice and clean, with great comments.  I'm using it and appreciate it.</description><pubDate>Wed, 28 Oct 2009 23:47:49 GMT</pubDate><dc:creator>Paul Paiva</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Thought I'd revisit this one... calculation for Leap Years can be a lot more simple...ISDATE(STR(@Year,4)+'0229')</description><pubDate>Tue, 02 Dec 2008 11:23:17 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>[quote][b]colin Robinson (4/20/2008)[/b][hr]i would also probably drop the table rather than truncate in this instance. You would then get the same Identity value for each date each time you ran the code.I have a question though, isnt there a performance impact of creating dim_time in this way with say a five year end date, as drop downs etc in front ends would be larger than required, and each date would create a null value in the fact table for every measure as the cube processesIm thinking we should use code like the example in a slowly changing dimension with code in an if block [code]ie if Getdate() &amp;gt;= (select max(date) from DimTime) then  exec createDates 30(x num) days more data[/code]an advantage to this is we would never have to revisit the time dimension unless there was a fundamental change like the Fiscal year dates changed and even this would just be a change to the sproc for future dates.[/quote]Just as a suggestion... It seems to me that a Calendar table of this nature (time dimension, whatever), should be made to go out to 01/01/2100 and that the GUI should have criteria in it to return the correct number of dates.Heh... as a side bar, I have to ask why anyone would use a loop to creat such a simple table... then I saw the date this was published and that pretty well explains it.  ;)</description><pubDate>Wed, 27 Aug 2008 19:03:03 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>[quote][b]colin Robinson (4/21/2008)[/b][hr]Thanks for the pointer,That would make a decent interview question. and it least a truncate means you can retain permissions etc.[/quote]Thanks for the feedback... Correct... no need to rebuild any permissions that way... Not sure it makes such a great interview question... if too many people ask it, others hear of it and it becomes one of those things people simply memorize without ever having done it.  I rather like weaving it into a simple multi-statement code example and ask them questions about what the intermediate and final result set's would be.  Sure, memorization could still help there, but at least I know that they know when it applies and what it actually does and when.</description><pubDate>Wed, 27 Aug 2008 18:54:06 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Hello. I'm also a newbie. You'll have to execute the stored procedure that comes with the code by typing 'exec sp_createTimeDim' and clicking the execute button.You'll get an error because no value has been instantiated for the isholiday column, so go to the design view and set it to null. This will, at least for now, enable you to execute the code and have a feel of the results;)</description><pubDate>Wed, 27 Aug 2008 04:39:59 GMT</pubDate><dc:creator>edomiobo-795748</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>sorry, 1'm from indonesian, little speak english :Dyour source code, i'm excute values in populate Time Dimension Null ?create dim time succes but value blank...thanks.... </description><pubDate>Sat, 09 Aug 2008 00:07:14 GMT</pubDate><dc:creator>khusnawi</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Thanks for the pointer,That would make a decent interview question. and it least a truncate means you can retain permissions etc.</description><pubDate>Mon, 21 Apr 2008 06:05:25 GMT</pubDate><dc:creator>colin Robinson-345240</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>[quote][b]colin Robinson (4/20/2008)[/b][hr]i would also probably drop the table rather than truncate in this instance. You would then get the same Identity value for each date each time you ran the code.I have a question though, isnt there a performance impact of creating dim_time in this way with say a five year end date, as drop downs etc in front ends would be larger than required, and each date would create a null value in the fact table for every measure as the cube processesIm thinking we should use code like the example in a slowly changing dimension with code in an if block [code]ie if Getdate() &amp;gt;= (select max(date) from DimTime) then  exec createDates 30(x num) days more data[/code]an advantage to this is we would never have to revisit the time dimension unless there was a fundamental change like the Fiscal year dates changed and even this would just be a change to the sproc for future dates.[/quote]Truncation of a table results in the IDENTITY column being reset to its original seed... there is no need to drop the table to achieve this result.</description><pubDate>Sun, 20 Apr 2008 16:55:21 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>i would also probably drop the table rather than truncate in this instance. You would then get the same Identity value for each date each time you ran the code.I have a question though, isnt there a performance impact of creating dim_time in this way with say a five year end date, as drop downs etc in front ends would be larger than required, and each date would create a null value in the fact table for every measure as the cube processesIm thinking we should use code like the example in a slowly changing dimension with code in an if block [code]ie if Getdate() &amp;gt;= (select max(date) from DimTime) then  exec createDates 30(x num) days more data[/code]an advantage to this is we would never have to revisit the time dimension unless there was a fundamental change like the Fiscal year dates changed and even this would just be a change to the sproc for future dates.</description><pubDate>Sun, 20 Apr 2008 13:41:31 GMT</pubDate><dc:creator>colin Robinson-345240</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>I was playign with this and noticed that the table population code misses setting the IsHoliday flag. Since the table has set that column to not null, the insert fails. </description><pubDate>Tue, 11 Mar 2008 10:07:58 GMT</pubDate><dc:creator>chenthor</dc:creator></item><item><title>RE: Create and Populate Time Dimension</title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>This can be hugely useful, although for accuracy's sake i'd suggest renaming it the "Date Dimension", since it doesn't really have anything to do with Time... A Time dimension would deal with Hours/Minutes/Seconds (and that's what i was looking for).:)</description><pubDate>Mon, 04 Feb 2008 12:41:06 GMT</pubDate><dc:creator>silly_king</dc:creator></item><item><title>Create and Populate Time Dimension </title><link>http://www.sqlservercentral.com/Forums/Topic401437-436-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Data+Warehouse/30087/"&gt;Create and Populate Time Dimension &lt;/A&gt;[/B]</description><pubDate>Sat, 22 Sep 2007 10:53:15 GMT</pubDate><dc:creator>patilds</dc:creator></item></channel></rss>