mcnewsxp (mcourter@mindspring.com) writes:
> i have a table that is used to get dates. the table needs to be
> updated every year. the value for the first date in the first row is
> set then the remaining 40 rows contain the previous row's date + 7.
> the other column contains the year plus the week number. eg 201040.
> this increments to 201052 then goes to 201120 then 201121 to 201139.
> i'm looking for an smart example to do this each year with a stored
> proc.
I'm afraid that I don't quite follow. It is a little bewildering that
the table only has 41 rows, but is updated yearly. Someone something is
missing it seems.
Then again, since this procedure is only yearly and there are so few rows,
there is not any need for anything smart, but a simple cursor would do.
How are the weeks numbered? ISO or as in the US? On which day does the
week start?
--
Erland Sommarskog, SQL Server MVP, esquel.RemoveThis@sommarskog.se
Links for SQL Server Books Online:
SQL 2008:
http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005:
http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx