insert @t select 1,''
union all select 2,''
union all select 3,''
union all select 4,''
union all select 5,''
union all select 6,''
union all select 7,''
declare @Beg varchar(10)
set @Beg='004'
--开始处理
declare @a varchar(10)
set @a=right('000'+rtrim(cast(@beg as int)-1),3)
update @t
set @a=right('000'+rtrim(cast(@a as int)+1),3),a=@a
--显示结果
select * from @t
--结果
id a
----------- ----------
1 004
2 005
3 006
4 007
5 008
6 009
7 010