UPDATE Tbls.Host SET
HostActvTyp = CASE, HostPrevTyp = CASE WHEN LENGTH(RTRIM(LTRIM(HostCd)))=3
then 'CORE'
ELSE END,
HostActvTyp = CASE, HostPrevTyp = CASE WHEN SUBSTR(RTRIM(LTRIM(HSTHC)),4)='P'
then'PROSPECTING'
ELSE END,
HostActvTyp = CASE, HostPrevTyp = CASE WHEN SUBSTR(RTRIM(LTRIM(HSTHC)),4)='I'
then'INDEPENDENT'
ELSE END,
HostActvTyp = CASE, HostPrevTyp = CASE WHEN SUBSTR(RTRIM(LTRIM(HSTHC)),4)='R'
then 'REACTIVE'
ELSE END,
HostActvTyp = CASE, HostPrevTyp = CASE WHEN SUBSTR(RTRIM(LTRIM(HSTHC)),4)='N'
then 'NEW'
ELSE END;
答案 0 :(得分:1)
这似乎是您想要的。
UPDATE Tbls.Host set
HostPrevTyp = CASE WHEN LENGTH(TRIM(HostCd))=3 then 'CORE'
WHEN SUBSTR(TRIM(HSTHC),4)='P' then'PROSPECTING'
WHEN SUBSTR(TRIM(HSTHC),4)='I' then'INDEPENDENT'
WHEN SUBSTR(TRIM(HSTHC),4)='R' then 'REACTIVE'
WHEN SUBSTR(TRIM(HSTHC),4)='N' then 'NEW'
ELSE 'UNKONWN' END
/*WHERE Clause maybe?*/
;