Msg 7347, Level 16, State 1, Line 1

I am finishing up a migration to sql 2012 when this error below occurrs when I run the view on the sql 2012 server:

OLE DB provider 'OraOLEDB.Oracle' for linked server 'XXXXX' returned data that does not match expected data length for column '[OraOLEDB.Oracle].SOURCE'. The (maximum) expected data length is 64, while the returned data length is 30.

I am running this view which has been working and still does work on a sql 2008 server.
This view performs an openquery on XXXXX and the SOURCE Column is created as below:

select * from openquery(XXXXX,'
            SELECT   ''Custom Calc'' source')

This creates a column named 'source' and populates the column with 'Custom Calc'
rhservanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RindbaekSenior ConsultantCommented:
It could be a characterset issue.

In Oracle you can define NLS_LENGTH_SEMANTICS it can be either byte(default) or char.
It is used for defining how CHARS are stored. It's important if you use multibyte charactersets, where a char(32) field in say japanese uses more than 32 bytes of space.

So my initial guess is that your character sets are different on the sql 2008 & 2012 and that your 2012 charset isnt completly comptible with the data in the row in question.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rhservanAuthor Commented:
Hey thanks Rindbaek for the prompt response,

After I cast as a varchar it worked fine.
Below is the solution:

select * from openquery(XXXXX,'
            SELECT  CAST(''Custom Calc'' AS VARCHAR(50)) source')
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.