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

Creating a view based on current date data 1

Status
Not open for further replies.

TeriCoombes

Technical User
Aug 26, 2004
22
US
I am having a problem with my SQL statement. I am trying to query out results in a table based on a date column. However, when I try:

WHERE (dbo.tblTestResults.LastModified = Date())

I get an ADO error that says Date is not a recognized function.

When I try:

WHERE (dbo.tblTestResults.LastModified = GetDate())

then I don't get any results at all when I know there are some. The same thing happens if I try:

WHERE (dbo.TestResults.LastModified = { fn CURDATE() })

Please help.
 
Datetime columns and the getdate system function both store dates and times to the milisecond. You have to convert them into a usable date only string to do this compair.

Code:
where convert(varchar(10), dbo.tblTestResults.LastModified, 101) = covnert(varchar(10), getdate(), 101)

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
cool.

Denny
MCSA (2003) / MCDBA (SQL 2000)

--Anything is possible. All it takes is a little research. (Me)

[noevil]
(Not quite so old any more.)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top