Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 determine number of characters from bytes

Author  Topic 

BitShift
Yak Posting Veteran

98 Posts

Posted - 2007-04-02 : 16:03:27
Im getting an extract from an ms access table. Some of the fields are long, memo or text. The table is exported to a text file in fixed width format.

I was looking at this regarding ms access file types
http://allenbrowne.com/xbase-05.html

How, for example, do I determine how many characters will be in a field that is exported from a field of type long. For long, the numeric value can be up to 32bit (4 bytes ?). So what does this translate into for the number of character in the exported data file ?

snSQL
Master Smack Fu Yak Hacker

1837 Posts

Posted - 2007-04-03 : 13:31:39
Once you export to a text file all that info goes out the window because an integer number stored in 32 bits inside Access becomes a text string. So 10, 11, 12, 13 all takes 2 characters, which is 2 or 4 bytes in a text file depending on the text encoding (text is always either 1 or 2 bytes per character) - but 12345, 36283, 91928 all take 5 or 10 bytes of text. The point is that it depends on how big the number is, whereas a 32 bit integer inside Access is always 4 bytes whether the number is -1000000, 0 or 1000000.

You said your text file is fixed width, so in that case I assume you're padding with spaces which are also one 1 or two bytes just like all other characters, in that case each number is taking up the size of the fixed width column, so if the column is fixed at 10 characters, then 1, 63892, and 1028927823 are all 10 or 20 bytes in the text file.
Go to Top of Page
   

- Advertisement -