Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 SQLNCLI gives wrong column data from linked svr

Author  Topic 

born2bongo
Starting Member

2 Posts

Posted - 2008-04-08 : 11:40:46
I am running an SSIS package to extract data from a source SQL Server database to our own database. The source is on a linked server. The package worked until a column size was increased on a table on the source.

If I run a query against the linked server table I get the following error:

'OLE DB provider 'SQLNCLI' for linked server 'GSC-RPT.SVR.BANKONE.NET' returned data that does not match expected data length for column '[GSC-RPT.SVR.BANKONE.NET].[Peregrine].[dbo].[scProblem].short_description'. The (maximum) expected data length is 100, while the returned data length is 160.'

I've tried deleting the links and recreating them. Nothing works. I don't understand why my database query is expecting a data length of 100. Why does it not pick up the definition of the field length from the linked server? How has it retained this expectation when I have deleted the linkage and recreated it?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-04-08 : 11:46:55
It will error since source & destination column length dont match. Change the length of destination to make it consistent with source and refresh the metadata in your package and try executing it.
Go to Top of Page

born2bongo
Starting Member

2 Posts

Posted - 2008-04-08 : 11:58:25
No, it's not that.

I was trying to cut a long story short. I have abandoned the SSIS package and written an SQL query in SQL Server Management services, as follows:

'select max(len(short_description)) from dbo.Peregrine_Problem'

The error message I get is

'OLE DB provider 'SQLNCLI' for linked server 'gsc-rpt.svr.bankone.net' returned data that does not match expected data length for column '[gsc-rpt.svr.bankone.net].[Peregrine].[dbo].[scProblem].short_description'. The (maximum) expected data length is 100, while the returned data length is 148'

I can embed the same query into vba in an excel spreadsheet, and run that against an ADO connection to the same server, and it returns a valid result of 1024, with no error message. We also have a couple of access databases that run against linked tables, and they can handle the increased size.

It seems to be some kind of issue with SQLNCLI, but it's definitely not the package
Go to Top of Page
   

- Advertisement -