-2

I want to export the data from a table from linked server. The table has over 300,000 rows.

When I run this query:

SELECT * 
FROM [LSERVER].[LTechnologies].[Connector].[MASD]

I get an error:

OLE DB provider 'MSDASQL' for linked server 'LSERVER' returned data that does not match expected data length for column '[LSERVER].[LTechnologies].[Connector].[MASD]'. The (maximum) expected data length is 8000, while the returned data length is 8448.

The source is NetSuite linked to MS SQL as ODBC Data Source.

Is there any way to work around this limitation?

Thanks

Haim Ben
  • 1
  • 2
  • 2
    Please add source and destination table definition. – user_0 Jul 06 '22 at 07:18
  • Also what type of server is the linked server? – Charlieface Jul 06 '22 at 08:41
  • Does this answer your question? [OLE DB provider 'for linked server returned data that does not match expected data length for](https://stackoverflow.com/questions/56683530/ole-db-provider-for-linked-server-returned-data-that-does-not-match-expected-da) – huMpty duMpty Jul 06 '22 at 09:58
  • @huMptyduMpty I tried the query with OPENQUERY as it says there and still gets the same errorץ – Haim Ben Jul 07 '22 at 08:18

2 Answers2

1

Is there any way to work around this limitation?

The typical workaround is to use OPENQUERY to send a "passthrough" query to the target system and ask it to perform type conversions to the types that actually work.

David Browne - Microsoft
  • 80,331
  • 6
  • 39
  • 67
0

Haim, it sounds like a built limitation limiting varchar or nvarchar to 8K characters. I have seen this a couple times but never seen anyone beat it - normally we just exclude the column. However if it's worth the time, you could find the column and do a LEFT([column], 7999) to see if you can at least get most of the data back. Hope it helps.

JJB
  • 53
  • 4