我无法弄清楚为什么这说''错误的synax附近>'
case changeuserid
when charindex('toolbar',lower(changeuserid) > 0 then 'TOOLBAR'
when charindex('mflynn',lower(changeuserid) > 0 then 'MFLYNN'
else (select username from CLAIMSAUDIT_USERS where MC400ID_PHP=changeuserid)
end AS 'dbusername',
答案 0 :(得分:1)
您可以使用以下case
格式,由于)
>
括号,也会出现语法错误
case
when charindex('toolbar',lower(changeuserid)) > 0 then 'TOOLBAR'
when charindex('mflynn',lower(changeuserid) ) > 0 then 'MFLYNN'
else (select username from CLAIMSAUDIT_USERS where MC400ID_PHP=changeuserid)
end AS 'dbusername'
答案 1 :(得分:1)
您错过了charindex()
的结束语。此外,您的case
语法不正确。您有一个额外的changeuserid
:
(case when charindex('toolbar', lower(changeuserid)) > 0 then 'TOOLBAR'
when charindex('mflynn', lower(changeuserid)) > 0 then 'MFLYNN'
else (select username from CLAIMSAUDIT_USERS where MC400ID_PHP = changeuserid)
end) AS 'dbusername',