Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Update query

$
0
0

Hi,

I have temporary table with records mem_id and recpt_id. I want to update the same table with advance money based on a calculation.

I have more than 40,000 records. How can write a query to loop in to update the advance column

I need to pass the rec_id and mem_id for 40,000 rows and update the adv_amt based on the output.

select 
 adv_amt =
 (convert(numeric(20,8),datediff(dd,@run_date,rept.newpaid) )/(convert(numeric(20,8),datediff(dd,rept.oldpaid,rept.newpaid)) ) * rept.rept_amount
 from recpt
 where rept.recpt_id = @rec_id
 and rept.mem_id = @mem_id

Regards,

kccrga



Viewing all articles
Browse latest Browse all 23857

Trending Articles