ACC1x: 255-Char String Displays Only 254 Characters with ODBC

ID: Q100658


The information in this article applies to:


SYMPTOMS

When you attach a remote table using ODBC, data in 255-character fields in the attached table appears to be truncated after the 254th character.


CAUSE

A data buffer is set one character too small to display all the data in the field. Note that only the display is being truncated, the data itself is unchanged.


RESOLUTION

Create a Memo or Note field to contain data that is 255 characters long.


STATUS

Microsoft has confirmed this to be a problem in Microsoft Access version 1.1. This problem no longer occurs in Microsoft Access version 2.0.

Steps to Reproduce Problem


  1. Create a table in ORACLE or Microsoft SQL Server containing the following SQL statements:
    
        In Oracle:      CREATE TABLE Bug (Id NUMBER(10,0),
                               Field1 CHAR(255))
                        CREATE UNIQUE INDEX BugPK ON Bug(ID)
    
        In SQL Server:  CREATE TABLE Bug (Id INT, Field1 CHAR(255))
                        CREATE UNIQUE INDEX BugPK ON Bug(ID) 


  2. Attach and view the table in Microsoft Access.


  3. In the ID field, enter the number 1. In Field1, enter 255 characters.


  4. Commit the record.

    Result: Only 254 characters are displayed in Field1.


An easy way to test this procedure is to create a macro called AutoKey, as follows:

   MacroName     Action
   ----------------------
   ^A            SendKeys

   AutoKey Actions
   ---------------
   SendKeys

      Keystrokes: {TAB}{a 255}
      Wait: No 

If you reopen the table, move to the 255-character column, and press CTRL+A, the SendKeys action automatically enters the letter "a" 255 times.

ORACLE is manufactured by Oracle Corporation, a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding this product's performance or reliability.

Additional query words: ODBC Oracle truncate


Keywords          : kbusage OdbcOthr 
Version           : 1.1
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: March 24, 1999