用SQl語句更改表中一個字段的值
sqlserver 寫法:update tablea set a=case len(a) when 1 then '00000'+a when 2 then '0000'+a when 3 then '000'+a when 4 then '00'+a when 5 then '0'+a endoracle寫法:update talbea set a=case length(a) when 1 then '00000'||a when 2 then '0000'||a when 3 then '000'||a when 4 then '00'||a when 5 then '0'||a end。
用SQl語句更改表中一個字段的值
sqlserver 寫法:
update tablea set a=case len(a) when 1 then '00000'+a when 2 then '0000'+a when 3 then '000'+a when 4 then '00'+a when 5 then '0'+a end
oracle寫法:
update talbea set a=case length(a) when 1 then '00000'||a when 2 then '0000'||a when 3 then '000'||a when 4 then '00'||a when 5 then '0'||a end
sql語句中case 修改字段值
剛才您已經發過一次這個帖子了,那個then的后邊只能跟著一個值,而不是一個等式。
select case * when '0000' then '未分類' else * end, * lx, count(*) zrs from (select distinct(code1||code2) dl,title1||title2 tdl from sys_certificate t where *ss='02') t left join sys_drivers p on *=substr(*ty,3,4) and groupid=128 group by (case * when '0000' then '未分類' else * end), * order by * asc。
轉載請注明出處華閱文章網 » sql語句修改字段值