Strange Sybase / SQL Server linked server issue 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?
try

select * from OPENQUERY(sybase, 'select left(cast(note as varchar(1000)), 257) note from table')