• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1796
  • Last Modified:

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'
1 Solution
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.
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')
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now