dansasu11
dansasu11

Reputation: 913

SQL Interest Calculation

I have to create a stored proc to calculate interest.

 --Sending these parameters to stored proc
 @rec_date date,
 @amount_paid numeric(18,2)

The rules are below, there are more rules but I can handle the other ones if I can get this

  1. Interest is calculated at a rate of 2% per month using a 30-day month on a pro-rata basis (not compounded).

  2. The @rec_date is used to determine the days between that date and today

  3. Interest is calculated based on the parameter @amount_paid

  4. If calculated interest > 5.00 then interest = calculate interest or else interest = 0

Upvotes: 0

Views: 2031

Answers (1)

Del Lee
Del Lee

Reputation: 482

Take a look here to get a feel for doing calculations with TSQL. Next, a good function to use will be DATEDIFF(). You can find more information on that here. This should get you going. Take a stab at it and post your code if you get stumped.

Upvotes: 1

Related Questions