SELECT data by day of week

Posted on 2006-05-01
Last Modified: 2008-01-09
Assuming that I have a table with a date value (mm/dd/yyyy) in one of the fields, how can I select records from that table based on the day of the week?  So, if I wanted to get all records that occured on a Tuesday for example.
Question by:AshleyBryant
    LVL 65

    Accepted Solution

    SET DATEFIRST 1  -- Set first day of week to Monday

    SELECT *
    FROM YourTableName
    WHERE DATEPART(dw, YourDateField) =4    
    LVL 12

    Author Comment

    So simple...

    Thanks for keeping me humble, hehe.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now