无法解决“SQL_Latin1_General_CP1_CI_AS”和“Latin1_General_CI_AS”之间的排序规则冲突等于操作

时间:2017-04-26 14:22:23

标签: sql

这是我的SQL查询

DELETE FROM [Prospects].[dbo].[P1]
WHERE RTRIM(LTRIM(DomainName)) IN
    (SELECT RIGHT(UserEmail, LEN(UserEmail) - CHARINDEX('@', UserEmail)) UserEmail
     FROM   [Recruiter].[dbo].[tblSystemUser])

如何解决这个问题?

3 个答案:

答案 0 :(得分:2)

您可以添加

COLLATE DATABASE_DEFAULT

到查询结束时将其转换并修复错误,但这会影响性能。

正如jarlh所建议的那样,将数据库的整理更改为相同的实际修复。

答案 1 :(得分:0)

尝试将COLLATE DATABASE_DEFAULT添加到您的查询中:

DELETE FROM [Prospects].[dbo].[P1]
WHERE RTRIM(LTRIM(DomainName)) COLLATE DATABASE_DEFAULT IN
(SELECT RIGHT(UserEmail, LEN(UserEmail) - CHARINDEX('@', UserEmail)) COLLATE DATABASE_DEFAULT UserEmail
 FROM   [Recruiter].[dbo].[tblSystemUser]) 

答案 2 :(得分:-1)

试试吧

    DELETE FROM [Prospects].[dbo].[P1]
    WHERE RTRIM(LTRIM(DomainName)) COLLATE DATABASE_DEFAULT IN
        (SELECT RIGHT(UserEmail, LEN(UserEmail) - CHARINDEX('@', UserEmail)) UserEmail
         FROM   [Recruiter].[dbo].[tblSystemUser

])