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 |
|
fuzzyip
Starting Member
35 Posts |
Posted - 2008-07-18 : 12:34:38
|
| I've got a table of about 150,000 entries with a products and a sold column.The sold column is in datetime format.When I do a manual query...select *from ansoldwhere datesold between '7/4/2008 0:00:01 am' and '7/4/2008 23:59:59 pm'It picks up about 1251 entries, but if I open the table, and export to excel and sort by date, I see that there are 5604 entries on the 4th of July.Why isn't my query able to pick up those dates?I made my query into a stored proc also with... select *from ANSoldwhere datesold >= @datebeginand datesold < dateadd (d, +1, @dateend)and city like '%'+@state+'%'order by datesoldThis also picks up only 1251 out of 5604Anyone have any ideas? I'm stumped. |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
fuzzyip
Starting Member
35 Posts |
Posted - 2008-07-18 : 13:02:35
|
quote: Originally posted by tkizer What does this return:select count(*)from ansoldwhere datesold >= '7/4/2008' and datesold < '7/5/2008'Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
returns 1251 |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
|
|
|