Re: Different results in SQL and Access
- From: "BruceM" <bamoob@xxxxxxxxxxxxxxxx>
- Date: Wed, 25 Jun 2008 07:32:00 -0400
How about:
trandate = #02/06/2008#
unless for some reason it is necessary to omit the first second of the day.
This suggests a reason why you are getting different results. The Date function stores the date as 12:00:00 AM. It coud be that such a date is being handled differently in the two systems (although I don't quite follow how a table is linked to a table, but maybe that's because of my unfamiliarity with SQL Server).
"Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx> wrote in message news:ujYiduq1IHA.1240@xxxxxxxxxxxxxxxxxxxxxxx
Pat Backowski wrote:Hi Everyone,I assume you have verified that the same data exists in both places ...
When I run the query
Select a,b,c from mytable where trandate >= #20/06/2008 00:00:01# and
trandate <= #20/06/2008 23:59:59# and (trantype = "OP" or trantype =
"NP);
in SQL Server, I get the result of 145,309 rows selected
in MS-Access, with a table Linked to the SQL Server table, I get the
result of 143,516.
Does anyone have any idea why this might happen?
Many thanks in advance for your kind consideration
Pat Backowski
If so, here is my theory:
Dates are stored differently in each system, resulting in different resolution. Two things:
1. you need to use a less ambiguous date format especially if you plan on deploying this to systems where the regional settings might be different, and
2. more importantly, you need to make this more "bullet-proof" in order to use it in both. I think this will work:
where trandate >= #2008-06-20# and
trandate < #2008-06-21#
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
.
- Follow-Ups:
- Re: Different results in SQL and Access
- From: Bob Barrows [MVP]
- Re: Different results in SQL and Access
- References:
- Re: Different results in SQL and Access
- From: Bob Barrows [MVP]
- Re: Different results in SQL and Access
- Prev by Date: Re: Paste errors when copying column name in a group by function
- Next by Date: Re: Write a query to retain records based on certain criteria
- Previous by thread: Re: Different results in SQL and Access
- Next by thread: Re: Different results in SQL and Access
- Index(es):
Relevant Pages
|