I have a sybase table which has a column note varchar(1000) null.

The following T-SQL will get the following error if there is a not-null value in note. (sybase is the linked server to the Sybase database)

select * from (sybase, 'select note from table')
select * from (sybase, 'select left(note, 257) note from table')
select * from (sybase, 'select left(note, 1000) note from table')

OLE DB provider 'ASEOLEDB' for linked server 'sybase' returned data that does not match expected data length for column '[ASEOLEDB].note'. The (maximum) expected data length is 257, while the returned data length is 258.

However, it works if the length parameter is less and equal to 256.

select * from (sybase, 'select left(note, 256) note from table')

Also the following SQL works.

exec ('select note from table') at [sybase]

Is it a bug of the Sybase driver?

1 Answer 1



select * from OPENQUERY(sybase, 'select left(cast(note as varchar(1000)), 257) note from table')
  • It gets the error of "The (maximum) expected data length is 257, while the returned data length is 258".
    – u23432534
    May 23, 2012 at 16:58
  • Whats Sybase version you are connected to, what sybase driver are you using and whats your SQL server
    – AmmarR
    May 24, 2012 at 4:42
  • The version is Adaptive Server Enterprise/12.5.4/EBF 16787 ESD#10/P/RS6000/AIX 5.1/ase1254/2159/64-bit/FBO/Mon Nov 2 10:11:59 2009. The driver is the OLEDB driver downloaded from sybase website.
    – u23432534
    May 24, 2012 at 17:47
  • 1
    I am using sybase driver 15.2 and i dont see the problem, your problem looks like its with the driver. I had many problems before with driver 12.5. If you can go for 15.2 try it
    – AmmarR
    May 24, 2012 at 18:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.