无法获取列#34; [MSDASQL] .LONG_DESCRIPTION"的当前行值。来自OLE DB提供程序" MSDASQL"对于链接服务器: - NETSUITE

时间:2017-11-15 11:08:54

标签: sql sql-server netsuite sql-server-2016

我正在尝试从Netsuite中的ITEM_SITE_CATEGORIES表获取数据到sql server 2016。 我正在运行以下查询:

select * from  OPENQUERY (LINKEDSRVR,'select LONG_DESCRIPTION FROM ITEM_SITE_CATEGORIES');

抛出错误

OLE DB provider "MSDASQL" for linked server "NETSUITE" returned message "Requested conversion is not supported.".
Msg 7341, Level 16, State 2, Line 1
Cannot get the current row value of column "[MSDASQL].LONG_DESCRIPTION" from OLE DB provider "MSDASQL" for linked server "NETSUITE". 

欢迎所有建议。

2 个答案:

答案 0 :(得分:0)

尝试投射您的列(并检查长度):

select * from  OPENQUERY (LINKEDSRVR,'
select
    CAST(LONG_DESCRIPTION AS CHAR(8000)) AS LONG_DESCRIPTION
    ,LENGTH(LONG_DESCRIPTION) AS LD_LEN
FROM ITEM_SITE_CATEGORIES');

如果LD_LEN = 8000,那么您将丢失一些数据。

答案 1 :(得分:-1)

你也可以这样做。

 select LONG_DESCRIPTION FROM  LINKEDSRVRNAME.DBNAME.SCHEMANAME.TABLENAME 

但是,对于常规运行查询,不建议使用Openquery,请使用同义词    代替