将openrowset用于特定记录时出错

时间:2011-03-09 07:04:17

标签: sql sql-server-2005 openrowset

INSERT INTO OPENROWSET('MSDASQL', 'Driver=PostgreSQL Unicode;uid=postgres;Server=localhost;port=5432;database=data;pwd=xxx',
    'select SanctionId,SchemeType,SchemeCode,CorrigendumStatus,AttendumStatus,yearofPlan,ReceivedDate from tesing WHERE SanctionId = ''-1'' ')
select SanctionId,SchemeType,SchemeCode,CorrigendumStatus,AttendumStatus,yearofPlan,ReceivedDate from testing where SanctionId=1103

执行上述查询时,我收到以下错误:

  

Msg 8152,Level 16,State 10,Line 1
  字符串或二进制数据将被截断。   声明已经终止。

有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:1)

您必须根据目标列定义检查源数据。

当您尝试将100个字符插入varchar(50)列

时会发生这种情况