I want to loop through all records in a table & then update some fields of the same record doing calculations of some fields of same record. I want this through Stored Procedure
I want to loop through all records in a table & then update some fields of the same record doing calculations of some fields of same record. I want this through Stored Procedure
Thanks
I want folks to actually ask a question when they want a response. And to include enough details about their problem for use to answer it.
But reading into your statement: Don't think "loops" think "sets". a simple update statement sounds like all you need. Something like this:
update mt from <myTable> as mt set mt.col5 = mt.col1 + mt.col2
That statement will update column [col5] for ALL rows in your table with the calculation results of col1+col2