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

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


LankaAnuradhaAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
Göran AnderssonConnect With a Mentor Commented:
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
 
hongjunCommented:
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
 
Göran AnderssonCommented:
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
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
LankaAnuradhaAuthor Commented:
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
 
MoondancerCommented:
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
 
hongjunCommented:
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
All Courses

From novice to tech pro — start learning today.