"David Portas" wrote:
> On 11 May, 05:48, Tango <T...@discussions.microsoft.com> wrote:
> > Hi
> > i have a table with a date & week field
> > the week number is 1,2,3 or 4
> > so as you scroll down the date there is 7 1's then 7 2's then 7 3's then 7
> > 4's then 7 1's & so on.
> >
> > This process starts from a specific date.
> >
> > is there any way to do an update statement on this ?
> >
> > Thank you
>
>
> In the following example the start date for week 1 is 2001-01-01.
>
> UPDATE Calendar
> SET WeekNum = FLOOR(DATEDIFF(DAY,'20010101',CalDate)/7.0);
>
> --
> David Portas, SQL Server MVP
>
> Whenever possible please post enough code to reproduce your problem.
> Including CREATE TABLE and INSERT statements usually helps.
> State what version of SQL Server you are using and specify the content
> of any error messages.
>
> SQL Server Books Online:
>
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
> --
>