|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 90,
Visits: 369
|
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 12:24 PM
Points: 2,
Visits: 32
|
|
Thank you for the script, will be very useful.
Tony
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 90,
Visits: 369
|
|
| My pleasure. Hope it helps!
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Tuesday, February 05, 2013 8:58 AM
Points: 5,
Visits: 27
|
|
I'm getting syntax errors in SQL 2008 in the Northwind D-Base beginning with this line...: WITH cte_date_base_table AS
Also it doesn't recognize ROW_NUMBER as a function name.
Help!
SVonTilbon
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 90,
Visits: 369
|
|
It was developed on SQL Server 2005, though it should work on 2008. Have you tried running it on a different database? Also, sometimes when you copy scripts from SQLServerCentral.com it also copies "funky" (and sometimes "invisible") characters with the code. It's happened to me and I've needed to reformat the code before it would run. Hope this helps.
Isn't Northwind SQL 2000? You need at least 2005 for the code to work as ROW_NUMBER is not recognized in 2000 nor is CTE.
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Thursday, May 09, 2013 7:52 AM
Points: 392,
Visits: 619
|
|
Nice-looking date dimension table.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 90,
Visits: 369
|
|
| Thanks! Dates can be a REAL pain to work with sometimes, so I figured that this could help a lot of people.
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, December 10, 2012 12:11 PM
Points: 66,
Visits: 101
|
|
| @svontilbon: works fine in sqlserver 2008 express
|
|
|
|
|
Valued Member
      
Group: General Forum Members
Last Login: Monday, December 10, 2012 12:11 PM
Points: 66,
Visits: 101
|
|
Thank you for sharing this, dates are kind of "fun" (or a pain). Now the script only lacks a parameter to set the first day in the week to Monday (= the case in Europe) and to add a column isoweek (isoweek 1= first week with at least 4 days in it I guess) - for example 1 January 2010 is in week 53 of the year 2009 ! so isoweek 200953 or something like that.
Guess that is work for somebody else !
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: Yesterday @ 2:19 PM
Points: 90,
Visits: 369
|
|
| I'll put it on the to do list. :) Great idea. As for the first day of the week, it should change automatically to whatever your SQL Server instance settings are. So if day 1 is Monday rather than Sunday, the code should compensate for this. Hope that helps.
|
|
|
|