SQL 2000 更改中间的字

[复制链接]
查看11 | 回复0 | 2009-8-25 07:49:24 | 显示全部楼层 |阅读模式
不要第5位吗?declare @table table(aa varchar(20))insert @tableselect '2207-001231'unionselect '2007-0045672'unionselect '2007-001234'unionselect '2007-0123445'unionselect '2008-0021446'unionselect '2007789456'select * from @tableupdate @table set aa='2007-0'+left(replace(aa,'2007-00',''),4)where aa like '2007-00%'select * from @table如果要第五位就把+left(replace(aa,'2007-00',''),4)中的4改为5
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行