From: rodchar on 16 Apr 2010 10:55 Hi All, Given: year = 2009 week = 3 How would I build a temp table of year/week values 27 weeks back. for the example above: 2009, 3 2009, 2 2009, 1 2008, 52 2008, 51 .... (Also, doesn't some years have 53 weeks?) thanks, rodchar
From: rodchar on 16 Apr 2010 12:04 About the 53/54 week issue is no longer an issue. 2008, 52 will work fiine. "rodchar" wrote: > Hi All, > > Given: > year = 2009 > week = 3 > > How would I build a temp table of year/week values 27 weeks back. > > for the example above: > > 2009, 3 > 2009, 2 > 2009, 1 > 2008, 52 > 2008, 51 > ... > > (Also, doesn't some years have 53 weeks?) > > thanks, > rodchar
From: Plamen Ratchev on 16 Apr 2010 12:30 You can create a calendar table and pull any number of weeks you want: http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html -- Plamen Ratchev http://www.SQLStudio.com
From: rodchar on 16 Apr 2010 17:01 got it, thanks Plamen. rod. "Plamen Ratchev" wrote: > You can create a calendar table and pull any number of weeks you want: > http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html > > -- > Plamen Ratchev > http://www.SQLStudio.com > . >
|
Pages: 1 Prev: is it necessary to drop temp table in stored proc Next: Timestamp default value |