Get a date values from monday to sunday started by first day of motnh

  • Hello SQL-Gurus,

    I'm really happy to find this site as knowledge base. Now I'm facing another issue, I would like to list all date from the first day of month. The only problem is that, as no one will be working saturday and sunday, these two days are not existing in my table. Assuming that first business day is should be monday and a first day of month is not always starting by monday I would like to describe examplary the problem:

    01.01.2010 = Friday from this date

    I would like to write (sql statement, not procedure ) in a temp table by appliying calculations on this date:

    Date Dayname

    ---------- ---------

    01.01.2010 - friday

    02.01.2010 - saturday

    03.01.2010 - sunday

    04.01.2010 - monday

    05.01.2010 - tuesday

    06.01.2010 - wednesday

    07.01.2010 - thursday

    08.01.2010 - friday

    09.01.2010 - saturday

    10.01.2010 - sunday

    .

    .

    .

    Could you please help.

    Thanks

    Mamadou

  • Hi there,

    Look in this post http://qa.sqlservercentral.com/Forums/Topic844084-338-1.aspx the reply from Dave Ballantyne.

    José Cruz

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply