It's fairly easy to do with a number table. The code below shows how.It uses a function to generate a table of numbers. You can get the code for the F_TABLE_NUMBER_RANGE function on this link:http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=47685declare @start_date datetimedeclare @end_date datetimedeclare @days intselect @start_date = '2005/12/28'select @end_date = '2006/01/06'select @days = datediff(dd,@start_date,@end_date) +1select [Date] = dateadd(dd,number-1,@start_date), [Day of Week] = datename(weekday,dateadd(dd,number-1,@start_date))from dbo.F_TABLE_NUMBER_RANGE( 1, @days )order by numberDate Day of Week------------------------------------------------------ -------------2005-12-28 00:00:00.000 Wednesday2005-12-29 00:00:00.000 Thursday2005-12-30 00:00:00.000 Friday2005-12-31 00:00:00.000 Saturday2006-01-01 00:00:00.000 Sunday2006-01-02 00:00:00.000 Monday2006-01-03 00:00:00.000 Tuesday2006-01-04 00:00:00.000 Wednesday2006-01-05 00:00:00.000 Thursday2006-01-06 00:00:00.000 Friday(10 row(s) affected)
CODO ERGO SUM