以下代码:
SELECT *
FROM portal.workflow AS w
INNER JOIN portal.workflow_type AS wt
ON w.workflow_type_id = wt.workflow_type_id
WHERE wt.doc_type IN ('CentreEV', 'Expenditure Voucher')
AND w.varchar_1 NOT IN ( select f1.BAT_NAME as 'DocumentFile'
from openquery(QICRE_F1, 'select *
from dbo.IO_GLF_BAT_CTL_VW
where bat_stat = ''S'' ') f1
where f1.USAGE_STAT = 'A' )
抛出以下错误:
消息468,级别16,状态9,行1无法解析排序规则 “Latin1_General_CI_AS”与“Latin1_General_CS_AS”之间的冲突 等于操作。
我已尝试使用以下内容解决此问题,但我收到语法错误。我不知道(即使在查看文档之后)在这种情况下应如何做到这一点:
SELECT *
FROM portal.workflow AS w
INNER JOIN portal.workflow_type AS wt
ON w.workflow_type_id = wt.workflow_type_id
WHERE wt.doc_type IN ('CentreEV', 'Expenditure Voucher')
AND COLLATE Latin1_General_CI_AS w.varchar_1 NOT IN
( select f1.BAT_NAME as 'DocumentFile'
from openquery(QICRE_F1, 'select *
from dbo.IO_GLF_BAT_CTL_VW
where bat_stat = ''S'' ') f1
where f1.USAGE_STAT = 'A' )
答案 0 :(得分:3)
您的查询可能有2个问题。试试这样的事情
...
WHERE ...
AND w.varchar_1 COLLATE Latin1_General_CI_AS IN
...
您可能需要在openquery命令中添加相同的语法。这是我不确定它是否会工作的地方,因为您可能需要使用linkedserver.database.schema.table语法 - 只需要测试它。但是这样的事情:
from openquery(QICRE_F1, 'select bat_name COLLATE Latin1_General_CI_AS
from dbo.IO_GLF_BAT_CTL_VW
where bat_stat = ''S'' ') f1
祝你好运。