SitePoint Sponsor |
|
User Tag List
Results 1 to 2 of 2
Thread: usage of DateValue in SQL server
-
Mar 2, 2005, 03:45 #1
- Join Date
- May 2003
- Location
- tel aviv
- Posts
- 31
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
usage of DateValue in SQL server
Hi all,
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,
Dror
-
Mar 2, 2005, 05:34 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 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 --
http://msdn.microsoft.com/library/de...ca-co_2f3o.asp
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 --
Code:where table_name.required_date >= getdate() and table_name.required_date < dateadd(day,1,getdate())
Bookmarks