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!

DateTime Query

Status
Not open for further replies.

Reynet01

Technical User
Apr 27, 2004
59
US
I Know this is simple but how would I lookup records in a Datetime field that would only show me records for todays date.

If knowledge were power I would be a AAA battery!
 
have you tried...

select * from yourtable
where date = CONVERT(VARCHAR,(GETDATE()),101)
 
The problem is the field is datetime and basically I have tried

[DateofOrder]=Date() but I still get no records

If knowledge were power I would be a AAA battery!
 
how about

where convert((varchar,(dateoforder),101) = CONVERT(VARCHAR,(GETDATE()),101)

getdate() gets today's date.
 
SQL Alert bumped up to condition Orange.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Just a nod to vongrunt, re thread183-1005313.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
;-)

Reynet01, that post will also answer your question.

--James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top