View Single Post
  #2 (permalink)  
Old 09-26-2007, 03:38 AM
S.Vinothkumar S.Vinothkumar is offline
D-Web Genius
 
Join Date: May 2007
Posts: 1,061
S.Vinothkumar is on a distinguished road
Smile Re: Update the value back

Hey Leo,

Use my coding as following,

Code:
Declare MyCur Cursor

For

Select name,age From emp --- your query here 


Open MyCur

Declare @UserName Varchar(50)

Declare @Age int 
 

Fetch Next From Cursor Into @UserName, @Age

 

            While @@Fetch_Status = 0

             Begin 

 		Update emp set age = @Age *2 where [name]= @UserName -- do your calculation here 


             End


Close MyCur

Deallocate MyCur
__________________
S.VinothkumaR
Behind me is infinite power,
Before me is Endless Possibility,
Around me is Boundless Opportunity,
Why should I fear!
Reply With Quote