256 byte long value in varchar field returns 255 bytes and a 0

  • create table test256(test varchar(1024))

    insert into test256(test)

    values('123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456')

    Create an app that opens an ODBC connection.

    My SQLSRV32.DLL is version 2000.85.1117.00 8/4/2004

    dim psnpTemp as object

    Set psnpTemp = m_Database.OpenRecordset("select * from test256", dbOpenSnapshot, dbSQLPassThrough)

    look at psnptemp("test")

    In my environment, it is the first 255 chars and the last char ('6') is an ascii 0

    This doesn't happen from and Oracle db, obviously with an Oracle ODBC driver.

    Anyone seen that before?

    TIA,

    Paul

  • Yes, when I used ODBC 256 characters was the default max length of returning strings.

    Changing to the newer OLEDB solved that problem.

     


    N 56°04'39.16"
    E 12°55'05.25"

  • I've seen similar things with ODBC as well. OLEDB, or better yet, ADO, should fix this.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply