SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


OLE DB provider 'MSDASQL' returned an unexpected data length for the fixed-length column


OLE DB provider 'MSDASQL' returned an unexpected data length for the fixed-length column

Author
Message
Ezhilan
Ezhilan
SSC-Enthusiastic
SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)

Group: General Forum Members
Points: 113 Visits: 61
Hi,

When I tried executing the following query, I got the error as follows.
Please tell me, how I can sort this out..

SELECT
IM_CODE,
IM_OS_UT_ACCUMULATION,
IM_OS_ZA_SEC_9B_DEF,
IM_OS_ZA_RSC_REGION_DEF,
IM_OS_VOLATILITY,
IM_OS_RI_RIGHTS_ENTITLE,
IM_OS_RI_SHARE_SPLIT,
IM_OS_DIV_CURR,
IM_OS_XD,
CASE WHEN IM_OS_BN_DUE_DATE = 0
THEN NULL
ELSE CONVERT(DATETIME, IM_OS_BN_DUE_DATE - 36525)
END AS BN_DUE_DATE,
CASE WHEN IM_OS_RI_DUE_DATE = 0
THEN NULL
ELSE CONVERT(DATETIME, IM_OS_RI_DUE_DATE - 36525)
END AS RI_DUE_DATE,
IM_OS_OPTION_TRADED,
IM_OS_ISSUE_CAPITAL,
IM_OS_TERM_TO_LISTING,
IM_OS_NEW_ISSUE,
IM_OS_MAIN_BOARD_LIST,
IM_OS_EARN,IM_OS_NTA,
IM_OS_LOT,
CASE WHEN IM_OS_DIV_DUE_DATE = 0
THEN NULL
ELSE CONVERT(DATETIME, IM_OS_DIV_DUE_DATE - 36525)
END AS DIV_DUE_DATE,
IM_OS_CAPITAL,IM_OS_BETA,
IM_OS_ANNUAL_DIV,
IM_OS_PAID_UP_VALUE,
IM_OS_PAR
FROM OPENQUERY(DB1, 'SELECT * FROM TBL1 WHERE IM_CATEGORY = ''OS'' OR IM_CATEGORY = ''RI''')


/********************/
Error
/*********************/
Server: Msg 7347, Level 16, State 1, Line 1
OLE DB provider 'MSDASQL' returned an unexpected data length for the fixed-length column '[MSDASQL].IM_OS_DIV_DUE_DATE'. The expected data length is 6, while the returned data length is 0.
OLE DB error trace [Non-interface error: Unexpected data length returned for the column: ProviderName='MSDASQL', TableName='[MSDASQL]', ColumnName='IM_OS_DIV_DUE_DATE', ExpectedLength='6', ReturnedLength='0'].

/***************************/

Kindly help me on this issue..

Regards,
Ezhilan
suparurks
suparurks
Forum Newbie
Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)Forum Newbie (4 reputation)

Group: General Forum Members
Points: 4 Visits: 10
I reply not because I know the solution but I want to share that I got the same problem with MySQL linked server (through ODBC). It seems that the problem occurs with columns with CHAR(1) and CHAR(2) data types when the data is empty. NULL does not create errors.
I have searched for several hours and found no clear solution. Now all I can do is avoiding those columns in the queries.
Chad Carter
Chad Carter
SSC-Enthusiastic
SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)SSC-Enthusiastic (113 reputation)

Group: General Forum Members
Points: 113 Visits: 1157
I have also seen this issue and have not yet found a permanent fix for it. I did see something from Microsoft about this error but that deals with Host Integration Server 2004. That may be what is causing my issue even though my link server is another SQL Server. The original source of the data is coming from DB2. I am wondering if that somehow the error carries through....

I did seem to find a way to can get around the error. For the column with the issue, CONVERT it to something. In my case, with my column EmployeeType, I changed it to CONVERT(VARCHAR,EmployeeType) as [EmployeeType]. This allows me to get the data back as long as it is not used as part of the WHERE statements.

In case your issue is related to HIS2004, here is the link from Microsoft:

support.microsoft.com/kb/897246
Hope this helps!

Chad



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search