更新数据库包含字母的字段值
Posted ym296900664
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了更新数据库包含字母的字段值相关的知识,希望对你有一定的参考价值。
update HR_Employeesset fregno=substring(replace(FEmpCode,'F',1),3,7)
where (fregno='' or fregno=null) and patindex('%F%',FEmpCode)>0
update HR_Employees
set fregno=substring(replace(FEmpCode,'M',2),3,7)
where (fregno='' or fregno=null) and patindex('%M%',fempcode)>0
-- patindex('%F%',FEmpCode)>0
-- charindex('%F%',FEmpCode)>0
-- FEmpCode like '%F%'
以上是关于更新数据库包含字母的字段值的主要内容,如果未能解决你的问题,请参考以下文章