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 |
|
csphard
Posting Yak Master
113 Posts |
Posted - 2007-10-12 : 11:10:02
|
| field is define as appt_date (datetime,null)information in field is formatted as the following 2007-11-15 00:00:00.0002007-05-15 00:00:00.000How do I search for the date 05/15/2007I am doing the following select * from testtable where appt_date between '05/15/2007' and '05/15/2007'Is that ok or is there a better way.HelpHoward |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-12 : 11:11:02
|
select * from testtable where appt_date = '05/15/2007'select * from testtable where appt_date >= '05/15/2007' and appt_date < '05/16/2007' E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-12 : 11:20:50
|
| between '05/15/2007' and '05/15/2007'is UP TO Midnight 14/15th May. So if appt_date has some Time, in addition to the Date, you need to do< '05/16/2007'as the upper-bound, as Peso said, so that you include any appt_date pm 15th, containing time, up to (but not including) midnight 15/16th [which is considered to be the 16th, and not the 15th!]Kristen |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-15 : 03:24:21
|
Also dont forget to express dates in YYYYMMDD format MadhivananFailing to plan is Planning to fail |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-10-15 : 03:56:17
|
| Oops! |
 |
|
|
|
|
|