dbTalk Databases Forums  

Query won't run

comp.databases.ms-access comp.databases.ms-access


Discuss Query won't run in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Phil
 
Posts: n/a

Default Query won't run - 11-28-2010 , 11:06 AM






This query runs OK

SELECT Hosts.*
FROM Hosts;

but

SELECT DISTINCT Hosts.*
FROM Hosts;
gives an error (No number) "The field is too small to accept the amount of
data you attempted to add. Try inserting or pasting less data."

Any ideas please

Phil

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Query won't run - 11-28-2010 , 12:19 PM






Phil wrote:
Quote:
This query runs OK

SELECT Hosts.*
FROM Hosts;

but

SELECT DISTINCT Hosts.*
FROM Hosts;
gives an error (No number) "The field is too small to accept the
amount of data you attempted to add. Try inserting or pasting less
data."

Any ideas please

Phil
You likely have a Memo field in your table. DISTINct does not work with Memo
fields. You have two options:
1. Explicitly list the fields in your table, ommitting the Memo field
2. If you must include the Memo field, use the Left function to only include
the first 255 characters:
select distinct field1, field2, left(memofield,255) as memo_extract ...

Reply With Quote
  #3  
Old   
Phil
 
Posts: n/a

Default Re: Query won't run - 11-28-2010 , 04:03 PM



On 28/11/2010 18:19:17, "Bob Barrows" wrote:
Quote:
Phil wrote:
This query runs OK

SELECT Hosts.*
FROM Hosts;

but

SELECT DISTINCT Hosts.*
FROM Hosts;
gives an error (No number) "The field is too small to accept the
amount of data you attempted to add. Try inserting or pasting less
data."

Any ideas please

Phil
You likely have a Memo field in your table. DISTINct does not work with
Memo fields. You have two options:
1. Explicitly list the fields in your table, ommitting the Memo field
2. If you must include the Memo field, use the Left function to only
include the first 255 characters:
select distinct field1, field2, left(memofield,255) as memo_extract ...



Thanks Bob. Spot on.

Didn't know that

Phil

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.