求语句,批量生成序列号。
有一表,如下:
编号 名字 性别
25 张三 男
12 李四 女
19 王五 男
怎么样能够批量重新生成编号,以00001,000002开始
[解决办法]
- SQL code
alter table tb alter column [编号] varchar(8)declare @i int select @i=0update tb set id=right(100000+@i,5),@i+=1
发布时间: 2012-05-16 11:12:12 作者: rapoo
求语句,批量生成序列号。
有一表,如下:
编号 名字 性别
25 张三 男
12 李四 女
19 王五 男
怎么样能够批量重新生成编号,以00001,000002开始
[解决办法]
alter table tb alter column [编号] varchar(8)declare @i int select @i=0update tb set id=right(100000+@i,5),@i+=1