starbase59
MIS
I now have a simple table that has only the calendar dates for 2003(I was helped earlier at this site). I want to add the corresponding DaysOfTheWeek column for each date. Can I (and how do I) utilize the same loop? See code below:
Declare @year int, @dt smalldatetime
Set @year = 2003
Set @dt = Cast ( @year AS char(4)) + '-01-01'
While Year(@dt) = @year
Begin
Insert tblDates Values(@dt)
Set @dt = @dt + 1
End
Declare @year int, @dt smalldatetime
Set @year = 2003
Set @dt = Cast ( @year AS char(4)) + '-01-01'
While Year(@dt) = @year
Begin
Insert tblDates Values(@dt)
Set @dt = @dt + 1
End