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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Querying date data type according to month, day or year

Status
Not open for further replies.

gust1480

Programmer
Mar 19, 2002
148
PH
Can somebody please tell me how i can do a query on a date datatye according to month or day or year or combination of month and day or month n year and so on. Thanks!
 
check out the datepart, or year, month, and day built-in functions.

-------------------------
The trouble with doing something right the first time is that noboby appreciates how difficult it was.
- Steven Wright
 



for the date '01/01/1900'...

Code:
SELECT *
FROM _TABLE_
WHERE MONTH(_DATEFIELD_) = '01'
       And DAY(_DATEFIELD_) = '01'
       And YEAR(_DATEFIELD_) = '1900'

Might work.




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top