删除子段前两个数字的 sql 语句,

liuxingstar 2003-09-15 09:39:22
是这样的
table 表的的 c_age varchar
它有2000条以上的数据,每条的值都是00XXXX 的

我要删除前两位的"00" 应该怎么写
...全文
62 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
eminena 2003-09-15
  • 打赏
  • 举报
回复
当 c_age 的前两个字符为 '00' 且 c_age 的长度不小于 2 时 才才进行更新

update table set c_age = right(c_age,len(c_age)-2)
where left(c_age,2)='00' and len(c_age) >= 2
txlicenhe 2003-09-15
  • 打赏
  • 举报
回复
1:
update table set c_age = right(c_age,len(c_age)-2)
where len(c_age) >= 2

2:
update table set c_age = substring(c_age,3,len(c_age))
where len(c_age) >= 2
伍子V5 2003-09-15
  • 打赏
  • 举报
回复
update 表 set c_age=right(c_age,4)
friendliu 2003-09-15
  • 打赏
  • 举报
回复
update tablename
set c_age=substring(c_age,2,(len(c_age)-2)))
伍子V5 2003-09-15
  • 打赏
  • 举报
回复
update 表 set c_age=right(c_age,4)
txlicenhe 2003-09-15
  • 打赏
  • 举报
回复
1:
update table set c_age = right(c_age,len(c_age)-2)
where len(c_age) >= 2

2:
update table set c_age = substring(c_age,3,len(c_age))
where len(c_age) >= 2
yujohny 2003-09-15
  • 打赏
  • 举报
回复
update table
set c_age=right(c_age,len(c_age)-2)

34,590

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧