SqlServer遊標例子

lanchengxiaoxiao發表於2012-04-24
Declare @Age int
Declare @Name varchar(20)
Declare Cur Cursor For Select Age,Name From T_User  
Open Cur
Fetch next From Cur Into @Age,@Name
While @@fetch_status=0    
Begin
    Update T_User Set [Name]=@Name,Age=@Age
    Fetch Next From Cur Into @Age,@Name
End  
Close Cur  
Deallocate Cur

相關文章