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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-11-18 : 08:03:52
|
| Jonas writes "I have records to query that have a datetime field with this format dd/mm/yyyy hh:mm:ss am/pm. The time portions of the data in this field for the set of records of interest are all different. I need to get all the records that have a cetain date, regardless of the time. I tried "where fieldname >= date and fieldname < nextdaysdate" where I have casted the date and nextdaydate variables using CDate and they contain only the date - dd/mm/yyyy. I tried "fieldname like '%date%'" (worked on Access but not SQL server). The queries execute butI get no records found.Thanks" |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-18 : 08:13:26
|
| where dateCol >=DateAdd(day,DateDiff(day,0,@fromDate),0) and dateCol<DateAdd(day,DateDiff(day,0,@toDate),1)MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|