declare test cursor for
select studentcode from student where classid =25541 order by studentcode
declare @studentcode nvarchar(16),@ID2 nvarchar(10)
declare @ii int
set @ii=1
open test
fetch next from test into @studentcode
while @@fetch_status=0
begin
select @ID2=@ii--substring(@studentcode,16,2)
update student
set studentname=studentname+@ID2
where studentcode=@studentcode
set @ii=@ii+1
fetch next from test into @studentcode
end
close test
deallocate test
go
109




被折叠的 条评论
为什么被折叠?



