Could you guys help me with this code?
I hope it's not too hard.
I need an SQL Server stored procedure that does the follwing calculation:
" Interest_Rate (%)
Table A and B join based on an Account_Number
Calculation to be done (This example is for monthly payments only)
" Take Current_Balance from Table A and calculate the interest amount for 1 period
" Calc1 = a.Current_Balance x (( a.Interest_Rate/ 12) / 100)
" Add this to the balance
o New_Balance = a.Current_balance + Calc1
" Subtract the payment amount from the updated balance
o Ending_Monthly_Balance = New_Balance b.Payment_amount
" Add 1 month to the b.Payment_date
" Go to next month and repeat above calculation
" Stop when balance becomes zero or negative
" Compare the payment date calculated to the a.Final_Maturity_Date to determine number of months difference and return that number.