Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
helixpoint
Constraint Violating Yak Guru
291 Posts |
Posted - 2010-11-05 : 09:06:33
|
The field is a datetime fieldexample "2010-09-13 15:27:30.327"How do I query on the datetime field when I am passing a date like "09/13/2010"DaveHelixpoint Web Developmenthttp://www.helixpoint.com |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2010-11-05 : 09:18:12
|
SELECT * FROM YourTable WHERE DATEADD(day, 0, DATEDIFF(day, 0, dateField)) = '9/13/2010'but I strongly recommend using unambiguous date format:SELECT * FROM YourTable WHERE DATEADD(day, 0, DATEDIFF(day, 0, dateField)) = '20100913' |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-11-05 : 09:20:31
|
where datecol >= convert(datetime,'09/13/2010',101)and datecol < dateadd(day,1,convert(datetime,'09/13/2010',101)) No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|