Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query where todays date = a date in a table 1

Status
Not open for further replies.

Sandman007

Programmer
Jun 20, 2001
47
0
0
US
I have a table with "name" and "graduationdate". Is there a way I can make a query to automatically pull the names that are graduating today (having the query automatically pull todays date from the system)?

I am not sure about how to do this.
All I have so far is:

SELECT tableA.name WHERE tableA.graduationdate = ???

Thanks for any help or suggestions!
Sandman007
 
SQL syntax:
SELECT tableA.name WHERE tableA.graduationdate = getdate()

Access syntax:
SELECT tableA.name WHERE tableA.graduationdate = date()
 
getdate() will return system date and time. Querying for dates that match getdate() probably won't work. Convert the datetime of getdate() to date only. here is one way you can do that.

SELECT tableA.name
WHERE tableA.graduationdate = convert(char(11), getdate()) Terry L. Broadbent - DBA
Computing Links:
faq183-874 contains "Suggestions for Getting Quick and Appropriate Answers" to your questions in the SQL Server forum. Many of the ideas apply to all forums.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top