Results 1 to 2 of 2
Thread: usage of DateValue in SQL server
Mar 2, 2005, 02:45 #1
- Join Date
- May 2003
- tel aviv
- 0 Post(s)
- 0 Thread(s)
usage of DateValue in SQL server
I have the following SQL statement which works on ACCESS but does not work in SQL server
SELECT * FROM [table_name] where DateValue(Now()) < table_name.required_date
required_date is a 'timedate' field which has both the date and the time.
I need the sql statment to check only the date part of the field.
SQL server does not allow the usage of DateValue like access does.
What is the correct SQL statement which will perform this?
Thank in advance,
Mar 2, 2005, 04:34 #2
- Join Date
- Jul 2002
- Toronto, Canada
- 49 Post(s)
- 1 Thread(s)
dror, are you going to ask us every time your query does not work the same way in sql server as it used to in access?
i think it's time you started looking these things up yourself in the sql server manual
here's one page that will help you when the time comes to display a datetime value in a particular format --
as for this specific "DateValue" problem, if you want rows of the table for a given date, you should select a range of datetime values like this --
where table_name.required_date >= getdate() and table_name.required_date < dateadd(day,1,getdate())