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

Where clause datetime = date

Status
Not open for further replies.

Ed Andres

IS-IT--Management
Mar 27, 2001
142
US
I have a table that that has a datetime column and I want to select all records that are of a specific date regardless of the time.

When I try this code in query analyzer I get no records returned:

SELECT *
FROM TCData
WHERE TCData.dClockTime = '06/16/2006'

I suspect it is because without the time part it is not equal to anything. However, using this where clause returns nothing as well and I know there is 1 record with this datetime.

WHERE TCData.dClockTime = '06/16/2006 9:00:10 AM'

I'm guessing I need to Convert/Cast but am not sure how to do this just to get the date from a datetime. This has to be something pretty easy. Any help would be appreciated.

Ed
 
SQLDenis,
5 minutes - WOW!
Thanks for the speedy and accurate reply.

It works fine! - Sorry for the NOOB question

Ed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top