ms_dos

  博客园  :: 首页  :: 新随笔  ::  :: 订阅 订阅  :: 管理

select * from a
select * from b


declare Mycursor CURSOR
for select * from b

open Mycursor

declare @stuID nchar(10)
declare @math smallint

fetch next from Mycursor
into @stuID,@math

while(@@FETCH_STATUS = 0)
begin
 update a set math = @math where stuID = @stuID

 fetch next from Mycursor
 into @stuID,@math

end

close Mycursor

posted on 2010-03-29 12:25  ms_dos  阅读(201)  评论(0编辑  收藏  举报