Solved

Problem using a query on a column in MS access of datatype MEMO

Posted on 2001-08-10
7
268 Views
Last Modified: 2012-08-13
Hello,
I am using MS Access database for my current project. In one of the tables I have a column whose datatype is declared as memo so that I can store more than 255 characters. The data is of this type
3,4,5,365,46,76,567,76,86,8,78,2,443,.......
Along with this I have another column which has repeating values.For the time being let me name it as "id", of number type.
Now I wrote a query in SQL to retrieve the distinct values from the second column namely "id".
 
SELECT DISTINCT ID,COLUMN1 FROM TABLE_NAME

When I use this query it will fetch only 255 characters from COLUMN1 which is of type memo and which has more than 255 characters of data in some fields.But it wroks fine if I use a query without distinct.
The same problem arises when I try using GROUP BY also.
Is it because of the buffer size limitation.Is there any other way through which I can get the whole data with using distinct in my query.

Thank you


0
Comment
Question by:LankaAnuradha
7 Comments
 
LVL 33

Expert Comment

by:hongjun
ID: 6374952
I am not sure about this. Perhaps does your table has a primary key? Will do a research on it tonight or tomorrow. Going out now.

hongjun
0
 
LVL 29

Expert Comment

by:Göran Andersson
ID: 6379699
I don't know how this works with Access, but I use disconnected recordsets in MSSQL, and that totally removes the problems with text fields (same as memo in Access). The text fields can be handled just as any other field.

Try this:

Set rstNew = CreateObject("adodb.recordset")
rstNew.CursorLocation = 3 'adUseClient
Call rstNew.Open(strSQL, cnnDb, 3, 4) 'adOpenStatic,adLockBatchOptimistic
Set rstNew.ActiveConnection=Nothing

This will create a disconnected recordset, where the sql result will be moved from the sql server into the recordset object. You can actually close the database connection and still work with the recordset. This will also give a considerable speed up in certain cases.

As the data is moved into the recordset, the text fields will loose the quirks they usually have, like that the field can only be read once.
0
 

Author Comment

by:LankaAnuradha
ID: 6408657
This is with reference to the comment sent by Greenghost.
I tried this code as u said in my asp page.

<%
Set rstNew = server.CreateObject("adodb.recordset")
rstNew.CursorLocation = 3
'adUseClient
strSQL="select distinct statecode, coords from region"
rstNew.Open strSQL,ConStr,3 ,adOpenStatic,adLockBatchOptimistic
Set rstNew.ActiveConnection=Nothing
%>

About the database
statecode is number which gets repeated in some places.and Coords is of datatype memo and has more than 255 characters of data in some of the fields.

But it gives the same error.
Here is the error.The error doesn't show up when I remove the distinct in my query.
---------------------------
Microsoft JET Database Engine error '80040e57'
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data.

---------------------------
Is there any other way to retrive data of type memo using distinct or group by.
Thank you
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 29

Accepted Solution

by:
Göran Andersson earned 20 total points
ID: 6409879
For the disconnected recordset, use either
  rstNew.Open strSQL,ConStr,3,4
or
  rstNew.Open strSQL,ConStr,adOpenStatic,adLockBatchOptimistic

I don't think that you can use distinct on a memo field. You can't in MS SQL, at least. Not even a disconnected recordset will help here, as the error occurs inside the sql engine.

Storing comma separated strings in a database is something that I would avoid. I would store them in a separate table, if possible.

There is repeating id's but are there repeating id-column1 pairs? Otherwise distinct has no function.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7018777
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20166856.html
http://www.experts-exchange.com/questions/Q.20174888.html
http://www.experts-exchange.com/questions/Q.20238447.html
http://www.experts-exchange.com/questions/Q.20296146.html
http://www.experts-exchange.com/questions/Q.20296686.html
http://www.experts-exchange.com/questions/Q.20296687.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0
 
LVL 33

Expert Comment

by:hongjun
ID: 8672549
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
[points to GreenGhost]

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

hongjun
EE Cleanup Volunteer
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now