Here is the data requested by you:

AcctNum Code InComing Amt
1 1234 125
2 4321 10
Code 1234 gives me CodeType 'Med'
Code 4321 gives me CodeType 'Dep'

Table2
AcctNum CodeType ElectId Seq
1 'Med' 10 1
1 'Med' 11 2
2 'Dep' 12 1
Table3
AcctNum ElectId Amt
1 10 100
1 11 100
2 12 50
Basically based on Table2 and 3 I have 200 available for paying out codetype 'Med'

so from table1 incoming amt for pay out is 125 so I need to go to table 3 and
update the electid 10 as 0 and electid 11 as 75 based on the sequence in table2 I need to subtract from electid 10 first and then go to electid 11
After processing the acct num 1 I will go to acct number 2 and do the same. Please let me know how I can by pass using cursors.

I am on sql server 2000
Thanks