Using NOW() in SQL for date fields

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am just a newbie when it comes to SQL, but I am very amazed with its
features.

In a default mdb database I use "NOW" to filter a query with a datefield.
Like: SELECT * FROM tblOrders Where (((tblOrders.OrderDate) Between now()
And now()+3))

But in SQL this does not seems to work, how can I use the now statement in
SQL?
 
If you want to filter the records by date without the time then it's better
to use Date() that return the date, when Now return Date + time.
So records that occur in the same date but in earlier time will apear in the
query.

I'm not sure what you mean by SQL, do you want to use it in SQL server?
If that the case then use :
GetDate() equal to Now in Access
 
Dear Cohen,
I'm not sure what you mean by SQL, do you want to use it in SQL server?
If that the case then use : GetDate() equal to Now in Access

I mean a Access Project (*.adp) in SQL-server.

I was in the understanding the now() can only be used in mdb files, but I
just learned I was setting the brackets incorrect.

BTW time is not an issue as there is no timestamp in the datefields, however
GetDate is always safer.
Thanks for this suggestion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top