SQL 服务器整理语法错误
SQL Server collate syntax error
我已经使用 collate 进行了搜索,并且正在按照答案所说的相同方式使用它;但是,我收到一个错误
Incorrect syntax near '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
and (returns 无法解决等于操作的归类冲突。)
UPPER(K.VAL106) = UPPER(E.JOBCODE)
我在语法上做错了什么?
这一定是版本问题。通过 SQL SERVER 2012 Mgt Studio 查询工具执行 returns 预期结果没有错误。
我已经使用 collate 进行了搜索,并且正在按照答案所说的相同方式使用它;但是,我收到一个错误
Incorrect syntax near '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
and (returns 无法解决等于操作的归类冲突。)
UPPER(K.VAL106) = UPPER(E.JOBCODE)
我在语法上做错了什么?
这一定是版本问题。通过 SQL SERVER 2012 Mgt Studio 查询工具执行 returns 预期结果没有错误。