MSSQL2000链接到MSSQL2005查询出错
MSSQL2005里源表:
CREATE TABLE [dbo].[表名](
[Id] [bigint] NOT NULL,
[字段1] [smalldatetime] NULL,
[字段2] [int] NULL,
[字段3] [varchar](50) NULL,
CONSTRAINT [PK_表名] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
MSSQL2005链接上源数据库能正常查询.
MSSQL2000链接到MSSQL2005
执行:Select * from [链接名].[库名].[dbo].[表名]
时报错,错误信息如下:
OLE DB 错误跟踪[Non-interface error: Column '字段3'
(compile-time ordinal 2) of object '"库名"."dbo"."表名"'
was reported to have changed. The exact nature of the
change is unknown]。
消息 7356,级别 16,状态 1,第 1 行
OLE DB 提供程序 'SQLNCLI' 为列提供的元数据不一致。执行时更改了元数据信息。
字段3的数据类型为varchar
如果表里没有varchar类型的字段就查询正常.
求解决方案.
链接
SQL2005
SQL2000
------解决方案--------------------那用openquery()来替代链接服务器试试。