|
-
Jan 16th, 2006, 02:09 AM
#1
Thread Starter
Hyperactive Member
Current date in SQL
Hi,
I am trying to selecte records from a table and want to check if the date field has a value of todays date or not. I forgot how to tell SQL to check the field. I don't want to pass a date instead I want to use the keyword that I forgot. I think it is either CURRENT DATE or TODAY or something like that.
SELECT * FROM Payments WHERE P_date = current date
or
SELECT * FROM Payments WHERE P_date = TODAY
can someone please HELP?
Thanks.
-
Jan 16th, 2006, 02:11 AM
#2
Re: Current date in SQL
getdate()
But I think you'll have to parse it, because the result is in milliseconds (if I remember correctly). If you don't your date will never be equal to getdate().
-
Jan 16th, 2006, 02:32 AM
#3
Re: Current date in SQL
SQL server: GetDate (date + time)
MS Access: Date (date only)
Oracle: sysdate (date + time)
-
Jan 16th, 2006, 02:35 AM
#4
PowerPoster
Re: Current date in SQL
you could make current date a string and then assign the date() to it, then format() the date() to use date instead of date/time
however, the string wont accept spaces either so maybe you should do current_date instead or CurrentDate.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|