Storage length of field

gazsharpe101

Registered User.
Local time
Today, 15:40
Joined
Oct 23, 2007
Messages
47
Hi everyone,

I am using a table that stores data and one of the fields is just a text field with a maximum length of 10.

However, when I store the data in the field, if I only enter 5 letters in it, it stores the 5 letter word correctly but followed by some spaces (I assume 5 spaces but I may be wrong.

I cannot figure out why does anyone know why?

If not, then can I trim the field if I use it in a query/report?

Thanks.
Gareth.
 
What version of Access are you using? Do you also have Access as your backEnd? Why do you feel there are trailing spaces? That is not expected behavior for Access.
 
It is an SQL back end but it is set up as a text field in there as well because when I go into the table in design view it says that I cannot modify the properties as it is a linked table so it is obviously getting the settings from SQL.

I am using Access 2003. I am assuming it is something with SQL but I can't be sure. I really don't know why there are spaces because there aren't in other similar fields.
 
I agree that it is an SQL Server issue. Maybe one of the SQL Guru's will stop by and offer a suggestion.
 
perhaps its been previously imported from excel or something, and the data had spurious spaces, which werent trimmed off at the time.

if its just data, cant you just trim it off

harder if its a keyed field
 
In sql Server you can have a number of different types of text fields, text, char and varchar.

varchar works likes access in that it is variable in length, only storing up to the maximum number of characters specified with no trailing spaces.

Char is a fixed length field so white space is present at the end of the field if the number of characters entered is less than the max.

text is like an Access memo field.
 

Users who are viewing this thread

Back
Top Bottom