Solved

Problem with fixed-length column query from Oracle

Posted on 2006-07-06
4
782 Views
Last Modified: 2012-06-27
Hi,
I am quering Oracle DB from SQL server as below:

SELECT sysdate,a
FROM OPENQUERY([Myserver.xp.COM],'
select sysdate,to_char(''muntasir'') as a from dual')

shows:
Server: Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'MSDAORA' returned an unexpected data length for the fixed-length column '[MSDAORA].A'. The expected data length is 32, while the returned data length is 8.
OLE DB error trace [Non-interface error:  Unexpected data length returned for the column:  ProviderName='MSDAORA', TableName='[MSDAORA]', ColumnName='A', ExpectedLength='32', ReturnedLength='8'].

But ok with

SELECT sysdate,'Muntasir' as a
FROM OPENQUERY(Myserver.xp.COM],'
select sysdate  from dual')

What is the problem? Can any one please explain or help to solve it?
Thanks in  advance


0
Comment
Question by:muntasirrahman
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 50 total points
ID: 17204675
what about this:

SELECT sysdate,a
FROM OPENQUERY([Myserver.xp.COM],'
select sysdate, ''muntasir'' as a from dual')

and this:

SELECT sysdate,a
FROM OPENQUERY([Myserver.xp.COM],'
select sysdate, cast(''muntasir'' as varchar2(20)) as a from dual')
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now