我使用collate搜索并使用它的方式与答案说使用它相同;但是,我收到了错误
' COLLATE'
附近的语法不正确
这是我的问题:
SELECT
P.FIRST_NAME_SRCH,
P.LAST_NAME_SRCH,
' ' as Title,
CASE E.FULL_PART_TIME
WHEN 'F' THEN 'Full Time'
WHEN 'P' THEN 'Part Time'
WHEN 'O' THEN 'Occasional'
ELSE E.FULL_PART_TIME
END AS FULL_PART_TIME,
' ' as Capacity,
REPLACE(E.HOME_PHONE,'/','-') as HOMEPHONE,
' ' as MobilePh,
' ' as Email,
CONVERT(char(10),E.BIRTHDATE,101) as 'BIRTHDATE',
CASE
WHEN E.HIRE_DT > E.REHIRE_DT THEN CONVERT(char(10),E.HIRE_DT,101)
WHEN E.REHIRE_DT > E.HIRE_DT THEN CONVERT(char(10),E.REHIRE_DT,101)
ELSE CONVERT(char(10),E.HIRE_DT,101)
END as 'HIRE_DT',
' ' as CommPref,
RTRIM(K.LEVEL3) as 'JOBCODE',
E.EMPLID
FROM
HRPROD..PS_EMPLOYEES E, HRPROD..PS_PERSONAL_DATA P, TKCSDB..CTRLEVEL3CFG K
WHERE
E.COMPANY = 'WSQ'
AND E.EMPLID = P.EMPLID
AND K.VAL106 COLLATE DATABASE_DEFAULT = E.JOBCODE COLLATE DATABASE_DEFAULT
ORDER BY
P.LAST_NAME_SRCH
我试过(语法错误相同)
AND
UPPER(K.VAL106) COLLATE DATABASE_DEFAULT = UPPER(E.JOBCODE) COLLATE DATABASE_DEFAULT
和(返回无法解决对等操作的排序规则冲突。)
UPPER(K.VAL106) = UPPER(E.JOBCODE)
我在语法上做错了什么?
答案 0 :(得分:0)
这必须是版本的东西。通过SQL SERVER 2012执行Mgt Studio查询工具可以无错误地返回预期结果。