从链接服务器查询 table 时收到“不一致的元数据”错误

Receiving a `inconsistent metadata` error when querying a table from a linked server

SELECT * FROM [POSTGRESSQL35W].[Briefs].[public].[planbrief]

为了运行上面的查询,我已经挠头好几个小时了。我可以成功地从某些 table 中检索数据,但是,对于这个特定的 table,它会抛出以下错误。有谁知道如何规避这个?

另外,我已经知道 OPENQUERY 这个功能,我试过了,但还是不行。

Msg 7356, Level 16, State 1, Line 5
The OLE DB provider "MSDASQL" for linked server "POSTGRESSQL35W" supplied inconsistent metadata for a column. The column "rewarded" (compile-time ordinal 50) of object ""Briefs"."public"."planbrief"" was reported to have a "DBCOLUMNFLAGS_ISLONG" of 128 at compile time and 0 at run time.

我终于弄明白了。

以防其他人遇到此问题,解决方法是转至 Start > Search ODBC Data Source Administrator > System DNS > Configure

弹出 window 打开后,在选项下转到 Datasource

然后取消勾选Bools as Char,应用并保存。