473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Access - ODBC to SQL - Incorrect Results

I have a SQL Server 2005 DB that I set up an ODBC connection to so
that people can access the data through MS Access. There are 3
tables, each of which have a date column that is a varchar (20)
because the dates do not fall within the required range by SQL
server. The dates are stored in the following format - YYYY-MM-DD.
Two of the three tables can (and do return) the correct results in
ACCESS when you search on that date field. The third table, for some
reason, isn't responding to anything I try and search on. I've
brought up the entire table and attempted to filter on a value in the
date column and it still returns multiple different values in that
column. I've attempted to convert the field to String, Date, Cdate
and many others in Access and haven't had any luck with the results
returning anything correct.

If I go back to the SQL server tables, I can search on all 3 of the
tables using ='YYYY-MM-DD' in the date field and get correct
results.

Has anyone seen anything like this? Any tips on how to fix?
Nov 19 '07 #1
3 1829
It sounds like you are trying to mix apples with oranges. A datefield
is not a varchar field. Even if you change the datatype to varchar and
expect to get results that you would get using dates, obviously it isn't
happening. If you change the data type back to datetime it sounds like
your system wont work.

If your system isn't working when the respective fields are in the
correct data type mode, then you need to fix the design of your system.

Trying to tweak stuff on a sql server never works. It was specifically
desinged that way to prevent the usage of the apples/oranges paradigm
because even though apples and oranges may work for the first 10 million
records, you will eventually get that 10 millionth and one record where
all of a sudden it no longer works and your entire system gets messed up
because you can't locate the offending record because your are looking
for an apple that is really an orange.

Instead, you should post what the problem is when you are using the
correct data types.

Rich

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '07 #2
In SQL server I am getting the correct results for all the varchar
columns that hold dates in them. The problem is that the data in SQL
was imported from a different system that didn't do any date
verification, so the information held in those fields are not all
valid dates. That alone caused me hours of errors trying to import
the data into SQL server, forcing me to import that field as
varchar.

My question was why 3 fields defined as the same thing in SQL server
holding the same format of data are acting differently in ACCESS.
Nov 20 '07 #3
On Nov 19, 7:49 pm, Jensen.Ka...@gmail.com wrote:
My question was why 3 fields defined as the same thing in SQL server
holding the same format of data are acting differently in ACCESS.
This is one of those questions that is very difficult to answer
because it is so general, like "Why the sea is boiling hot" and
"Whether pigs have wings?"

Questions:
1. yyyy-mm-dd is 10 characters long. Why Varchar(20)?
2. Why yyyy-mm-dd rather than yyyymmdd? "-" has significance to many
search and filter engines beyond being a hyphen. It adds zip of
significance to yyyymmdd.
3. You say the data are in SQL server. You also say the data were
imported form SQL-Server. And you say, why won't what I want to
happen, happen in Access. Where are the data? And how are you
connecting? And what does in Access mean: on a form? in a recordset?
In the returns of a query? WHAT?

It sounds to me as if you are in too deep here. If you tell us some
specifics we might be able to help. I don't use ODBC but I've been
convinced of its effectiveness. It should be able to take your Access
commands and translate them into MS SQL-Server SQL that will give you
the results you need.

BTW. X-Base programs translated dates to yyyymmdd for sorting purposes
for years and years and years with no problems. Probably they still
do. So there should be no unsolvable problem in your using this
format. But I would create another date column and cast the yyyymmdd
strings to dates and use that. Why use a 13.5 compression ratio V-12
and give it regular gas ... or sub-regular gas?

Nov 20 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Mark Line | last post by:
Hello! I'm a python n00b! I've been writing in c++ for a few years so programming's not new to me, just python that I don't know the syntax!
5
by: Todd Huish | last post by:
I have noticed something disturbing when retrieving datasets over a relatively slow line (multiple T1). I am looking at about 25 seconds to retrieve 500 rows via a php-odbc link. This same select...
2
by: Jiwei06xie | last post by:
Hi All, I am trying to upgrade an Access 2000 DB to 2007 (using linked tables and ODBC to connect to backend SQL 2000 database). In my DB, I have a mainswitch board and some command buttons on it....
8
by: twomcfly | last post by:
Hi I have a SQL Server 2005 database with a list of results for a variety of people over time. i would like to be able to look at any row and from that row know the last 3 results for that person...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.