-- 删除字段最后两个字符
update 表 set 字段=left(字段, len(字段)-2)
where len(字段)>=2
--删除字段中的指定字符
update 表 set 字段=replace(字段, '要删除的字符串','')
where charindex('要删除的字符串',字段)>0
--删除字段中的前2个字符
update 表 set 字段=stuff(字段, 1,2,'')
where len(字段)>=2
--从字段指定位置(4)删除指定个数的字符(2)
update 表 set 字段=stuff(字段, 4,2,'')
where len(字段)>=4
如何批量删除字段中的最后几个字符?
最新推荐文章于 2020-10-28 16:59:33 发布