哈哈,那不是更容易?
create table table3
(
a varchar(8)
)
insert into table3
select 'TH000001'
union
select 'TH000002'
select * from table3
insert into table3
select substring(max(a),1,2)+substring(convert(varchar(7),(cast(substring(max(a),3,len(max(a))) as int)+1000001)),2,7) from table3
select * from table3
|