• DaveDB (1/14/2014)


    DATEPART(dw,Datestamp) IN (1,7)))

    Just one thing to watch out for DaveDB, the code above relies on your instance having Sunday as the first day of the week. That might not be the case on every instance/database, particularly if the default language for the isntance is not us_english, so you might want to explicitly set it as such by running:

    SET DATEFIRST 7

    You can check what the first day of the week is set to by running:

    SELECT @@DATEFIRST

    Regards

    Lempster