0

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?

marc_s
9,0626 gold badges46 silver badges52 bronze badges
asked May 9, 2012 at 21:29

1 Answer 1

1

try

select * from OPENQUERY(sybase, 'select left(cast(note as varchar(1000)), 257) note from table')
answered May 23, 2012 at 7:40
4
  • It gets the error of "The (maximum) expected data length is 257, while the returned data length is 258". Commented May 23, 2012 at 16:58
  • Whats Sybase version you are connected to, what sybase driver are you using and whats your SQL server Commented 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. Commented 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 Commented May 24, 2012 at 18:50

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.