Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

OLE DB provider 'MSDASQL' returned an unexpected data length for the fixed-length column Expand / Collapse
Author
Message
Posted Monday, January 28, 2008 11:21 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, December 8, 2009 10:24 AM
Points: 63, 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
Post #448689
Posted Wednesday, December 24, 2008 3:39 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, February 9, 2009 11:45 AM
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.
Post #625263
Posted Saturday, February 7, 2009 8:58 PM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Sunday, October 5, 2014 8:49 PM
Points: 89, Visits: 1,056
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



Post #652340
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse