2

以下代码:

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'   ) 
4

1 回答 1

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

祝你好运。

于 2013-01-14T02:17:11.587 回答