Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 691
  • Last Modified:

Find all rows based on day of week

I am importing an appointment schedule from an old software into a new one.  I have a situation where I need to seperate out some appointments.  Is there any way I can query the appointments table and say something like this:

SELECT * FROM Appointments WHERE DATE is a Tuesday?

This way I'll get all appointments that were scheduled on a Tuesday.  And I'll need to do the same for other weekdays as well.

NOTE:  I can pull this table into SQL Server 2008 if that makes querying easier.
NOTE:  All dates are in the year 2011.

JamesNT
0
JamesNT
Asked:
JamesNT
1 Solution
 
Rey Obrero (Capricorn1)Commented:
in access, you can use

format(Date(),"dddd")="Thursday"

or

weekday(Date())=5

0
 
Thomas_RoesCommented:
There is a function: (my date-field is called 'dag')

Weekday([dag])

You can filter on this.

Thomas Roes
0
 
p912sCommented:
Your complete SQL string would be like this.

SELECT * FROM Appointments WHERE ((Weekday([YOURDATEFIELDHERE])="3"));

0
 
GRayLCommented:
3 above should not be in quotes
0
 
p912sCommented:
Thanks for the grade and points!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now