Logo

SQL Server LPMTSCHED Function

Updated 2023-10-11 12:06:48.083000

Description

Use the table-valued function LPMTSCHED to generate a loan amortization schedule, given the period payment amount, the principal amount (or present value amount), and the balloon payment (or future value amount). The amortization schedule includes the payment number, the payment date, and the principal amount at the beginning of the period, the interest amount for the period, the principal payment for the period, any deferred interest for the period, and the ending principal amount.

LPMTSCHED supports loans with odd first periods, does US Rule or actuarial interest calculations, and allows you to specify a terminal (or future) value for the loan. LPMTSCHED also lets you calculate the amortization schedule using a different term for the amortization and the maturity, with the final payment amount adjusted for the outstanding principal balance.

LPMTSCHED lets you enter the periodic payment, the interest rate, or both. If the rate is not entered, the rate is calculated from the periodic payment. If the periodic payment is not entered, the periodic payment is calculated from the rate. If both the periodic payment and the rate are entered, then the schedule then the interest portion of each period is calculated using the rate, and the principal payment portion is calculated using periodic payment minus that interest payment amount. This may result in an odd final payment or even in a reduction in the number of payments for the loan.

Syntax

SELECT * FROM [westclintech].[wct].[LPMTSCHED] (
   <@PV, float,>
 ,<@LoanDate, datetime,>
 ,<@Pmt, float,>
 ,<@Rate, float,>
 ,<@FirstPayDate, datetime,>
 ,<@NumPmts, int,>
 ,<@Pmtpyr, int,>
 ,<@DaysInYr, int,>
 ,<@FV, float,>
 ,<@IntRule, nvarchar(4000),>
 ,<@Decimals, int,>
 ,<@LastPmtNum, int,>)

Arguments

@PV

the principal amount of the loan or lease. @PV is an expression of type float or of a type that can be implicitly converted to float.

@LoanDate

the date that the loan starts accruing interest. @LoanStartDate is an expression of type datetime or of a type that can be implicitly converted to datetime.

@Pmt

the payment made each period. @Pmt is an expression of type float or of a type that can be implicitly converted to float.

@Rate

the annual interest rate for the loan. @Rate is an expression of type float or of a type that can be implicitly converted to float.

@FirstPayDate

the date that the first payment is due. @FirstPayDate is an expression of type datetime or of a type that can be implicitly converted to datetime.

@NumPmts

the total number of payments to be recorded over the life of the loan. @NumPmts is an expression of type int or of a type that can be implicitly converted to int.

@Pmtpyr

the number of loan payments made in a year. @Pmtpyr is an expression of type int or of a type that can be implicitly converted to int.

@DaysInYr

the denominator number of days to be used in the calculation of the interest amount in the odd first period. @DaysInYr is an expression of type int or of a type that can be implicitly converted to int.

@FV

the future value at the end of the loan. @FV is an expression of type float or of a type that can be implicitly converted to float.

@IntRule

Identifies the loan as conforming to the US Rule ('U') or the actuarial rule ('A') regarding the compounding of interest in the odd first period.

@Decimals

the number of decimal places to round the calculated amounts. @Decimals is an expression of type int or of a type that can be implicitly converted to int.

@LastPmtNum

the last payment number if the life of the loan is shorter than the amortization period. @LastPmtNum is an expression of type int or of a type that can be implicitly converted to int.

Return Type

table

colNamecolDatatypecolDesc
num_pmtintThe payment number.
date_pmtdatetimeThe date of the payment.
amt_prin_initfloatThe principal amount at the beginning of the period. For the first period, the principal amount is the amount of the loan, otherwise the principal amount is the ending principal amount from the prior period.
amt_pmtfloatThe payment amount supplied to the function.
amt_int_payfloatThe interest payable amount for the period. The interest amount is the period interest rate (@Rate/@Pmtpyr) multiplied by the principal amount at the beginning of the period (amt_prin_init) rounded to the number of decimal places (@Decimals).
amt_prin_payfloatThe principal payment amount for the period. For actuarial accrual loans, the principal payment amount is the payment amount (amt_pmt) minus the interest payment amount (amt_int_pay). If the interest payment amount is greater than the payment amount, then the principal payment amount is negative. For US rule loans, the principal payment amount will always be greater than or equal to zero.
amt_int_deffloatThe interest deferral (or escrow) amount. For US Rule loans only. If the interest payment amount (amt_int_pay) is greater than the payment amount (amt_pmt) then the difference is put into this column. When the interest payments (amt_int_pay) become less than the periodic payment (amt_pmt), the interest deferral amount (amt_int_def) from prior periods are reduced to zero, before applying any amounts to principal payments (amt_prin_pay).
amt_prin_endfloatThe ending principal amount. Calculated as the beginning principal amount (amt_prin_init) less the principal payment amount for the period (amt_prin_pay).

Remarks

If @DaysInYr is NULL, then @DaysInYr = 360.

If @FV is NULL, then @FV = 0.

If @IntRule is NULL, then @IntRule = 'A'.

@FirstPayDate must be greater than @LoanDate.

@Pmtpyr must be 1, 2, 3, 4, 6, 12, 13, 24, 26, 52 or 365.

@NumPmts must be greater than 1.

@Rate must be greater than zero.

@DaysInYr must be 360, 364, 365, 365360 or 365365.

@PV must be greater than zero.

If @Decimals is NULL, then @Decimals = 2.

If @LastPmtNum is NULL, the @LastPmtNum = @NumPmts.

Examples

Generate the amortization schedule for a 50,000, 5-year loan starting on 1 November with payments due on the first of every month. The periodic payment is 966.64.

SELECT *
FROM wct.LPMTSCHED(   50000,        --Present Value
                      '11/01/2010', --Loan Date
                      966.64,       --Pmt
                      NULL,         --Rate
                      '12/01/2010', --First Payment Date
                      60,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02010-11-01 00:00:00.0000000050000
12010-12-01 00:00:00.00050000966.64250716.64049283.36
22011-01-01 00:00:00.00049283.36966.64246.42720.22048563.14
32011-02-01 00:00:00.00048563.14966.64242.82723.82047839.32
42011-03-01 00:00:00.00047839.32966.64239.2727.44047111.88
52011-04-01 00:00:00.00047111.88966.64235.56731.08046380.8
62011-05-01 00:00:00.00046380.8966.64231.9734.74045646.06
72011-06-01 00:00:00.00045646.06966.64228.23738.41044907.65
82011-07-01 00:00:00.00044907.65966.64224.54742.1044165.55
92011-08-01 00:00:00.00044165.55966.64220.83745.81043419.74
102011-09-01 00:00:00.00043419.74966.64217.1749.54042670.2
112011-10-01 00:00:00.00042670.2966.64213.35753.29041916.91
122011-11-01 00:00:00.00041916.91966.64209.58757.06041159.85
132011-12-01 00:00:00.00041159.85966.64205.8760.84040399.01
142012-01-01 00:00:00.00040399.01966.64201.99764.65039634.36
152012-02-01 00:00:00.00039634.36966.64198.17768.47038865.89
162012-03-01 00:00:00.00038865.89966.64194.33772.31038093.58
172012-04-01 00:00:00.00038093.58966.64190.47776.17037317.41
182012-05-01 00:00:00.00037317.41966.64186.59780.05036537.36
192012-06-01 00:00:00.00036537.36966.64182.69783.95035753.41
202012-07-01 00:00:00.00035753.41966.64178.77787.87034965.54
212012-08-01 00:00:00.00034965.54966.64174.83791.81034173.73
222012-09-01 00:00:00.00034173.73966.64170.87795.77033377.96
232012-10-01 00:00:00.00033377.96966.64166.89799.75032578.21
242012-11-01 00:00:00.00032578.21966.64162.89803.75031774.46
252012-12-01 00:00:00.00031774.46966.64158.87807.77030966.69
262013-01-01 00:00:00.00030966.69966.64154.83811.81030154.88
272013-02-01 00:00:00.00030154.88966.64150.77815.87029339.01
282013-03-01 00:00:00.00029339.01966.64146.69819.95028519.06
292013-04-01 00:00:00.00028519.06966.64142.6824.04027695.02
302013-05-01 00:00:00.00027695.02966.64138.48828.16026866.86
312013-06-01 00:00:00.00026866.86966.64134.33832.31026034.55
322013-07-01 00:00:00.00026034.55966.64130.17836.47025198.08
332013-08-01 00:00:00.00025198.08966.64125.99840.65024357.43
342013-09-01 00:00:00.00024357.43966.64121.79844.85023512.58
352013-10-01 00:00:00.00023512.58966.64117.56849.08022663.5
362013-11-01 00:00:00.00022663.5966.64113.32853.32021810.18
372013-12-01 00:00:00.00021810.18966.64109.05857.59020952.59
382014-01-01 00:00:00.00020952.59966.64104.76861.88020090.71
392014-02-01 00:00:00.00020090.71966.64100.45866.19019224.52
402014-03-01 00:00:00.00019224.52966.6496.12870.52018354
412014-04-01 00:00:00.00018354966.6491.77874.87017479.13
422014-05-01 00:00:00.00017479.13966.6487.4879.24016599.89
432014-06-01 00:00:00.00016599.89966.6483883.64015716.25
442014-07-01 00:00:00.00015716.25966.6478.58888.06014828.19
452014-08-01 00:00:00.00014828.19966.6474.14892.5013935.69
462014-09-01 00:00:00.00013935.69966.6469.68896.96013038.73
472014-10-01 00:00:00.00013038.73966.6465.19901.45012137.28
482014-11-01 00:00:00.00012137.28966.6460.69905.95011231.33
492014-12-01 00:00:00.00011231.33966.6456.16910.48010320.85
502015-01-01 00:00:00.00010320.85966.6451.6915.0409405.81
512015-02-01 00:00:00.0009405.81966.6447.03919.6108486.2
522015-03-01 00:00:00.0008486.2966.6442.43924.2107561.99
532015-04-01 00:00:00.0007561.99966.6437.81928.8306633.16
542015-05-01 00:00:00.0006633.16966.6433.17933.4705699.69
552015-06-01 00:00:00.0005699.69966.6428.5938.1404761.55
562015-07-01 00:00:00.0004761.55966.6423.81942.8303818.72
572015-08-01 00:00:00.0003818.72966.6419.09947.5502871.17
582015-09-01 00:00:00.0002871.17966.6414.36952.2801918.89
592015-10-01 00:00:00.0001918.89966.649.59957.050961.84
602015-11-01 00:00:00.000961.84966.654.81961.8400

Generate the amortization schedule for a 50,000, 5-year loan starting on 1 November with payments of 1,161.41 due on the fifteenth of every month starting 15-Apr-2011.

SELECT *
FROM wct.LPMTSCHED(   50000,        --Present Value
                      '11/01/2010', --Loan Date
                      1161.41,      --Pmt
                      NULL,         --Rate
                      '04/15/2011', --First Payment Date
                      60,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02010-11-01 00:00:00.0000000050000
12011-04-15 00:00:00.000500001161.412733.34-1571.93051571.93
22011-05-15 00:00:00.00051571.931161.41515.72645.69050926.24
32011-06-15 00:00:00.00050926.241161.41509.26652.15050274.09
42011-07-15 00:00:00.00050274.091161.41502.74658.67049615.42
52011-08-15 00:00:00.00049615.421161.41496.15665.26048950.16
62011-09-15 00:00:00.00048950.161161.41489.5671.91048278.25
72011-10-15 00:00:00.00048278.251161.41482.78678.63047599.62
82011-11-15 00:00:00.00047599.621161.41476685.41046914.21
92011-12-15 00:00:00.00046914.211161.41469.14692.27046221.94
102012-01-15 00:00:00.00046221.941161.41462.22699.19045522.75
112012-02-15 00:00:00.00045522.751161.41455.23706.18044816.57
122012-03-15 00:00:00.00044816.571161.41448.17713.24044103.33
132012-04-15 00:00:00.00044103.331161.41441.03720.38043382.95
142012-05-15 00:00:00.00043382.951161.41433.83727.58042655.37
152012-06-15 00:00:00.00042655.371161.41426.55734.86041920.51
162012-07-15 00:00:00.00041920.511161.41419.21742.2041178.31
172012-08-15 00:00:00.00041178.311161.41411.78749.63040428.68
182012-09-15 00:00:00.00040428.681161.41404.29757.12039671.56
192012-10-15 00:00:00.00039671.561161.41396.72764.69038906.87
202012-11-15 00:00:00.00038906.871161.41389.07772.34038134.53
212012-12-15 00:00:00.00038134.531161.41381.35780.06037354.47
222013-01-15 00:00:00.00037354.471161.41373.54787.87036566.6
232013-02-15 00:00:00.00036566.61161.41365.67795.74035770.86
242013-03-15 00:00:00.00035770.861161.41357.71803.7034967.16
252013-04-15 00:00:00.00034967.161161.41349.67811.74034155.42
262013-05-15 00:00:00.00034155.421161.41341.55819.86033335.56
272013-06-15 00:00:00.00033335.561161.41333.36828.05032507.51
282013-07-15 00:00:00.00032507.511161.41325.08836.33031671.18
292013-08-15 00:00:00.00031671.181161.41316.71844.7030826.48
302013-09-15 00:00:00.00030826.481161.41308.26853.15029973.33
312013-10-15 00:00:00.00029973.331161.41299.73861.68029111.65
322013-11-15 00:00:00.00029111.651161.41291.12870.29028241.36
332013-12-15 00:00:00.00028241.361161.41282.41879027362.36
342014-01-15 00:00:00.00027362.361161.41273.62887.79026474.57
352014-02-15 00:00:00.00026474.571161.41264.75896.66025577.91
362014-03-15 00:00:00.00025577.911161.41255.78905.63024672.28
372014-04-15 00:00:00.00024672.281161.41246.72914.69023757.59
382014-05-15 00:00:00.00023757.591161.41237.58923.83022833.76
392014-06-15 00:00:00.00022833.761161.41228.34933.07021900.69
402014-07-15 00:00:00.00021900.691161.41219.01942.4020958.29
412014-08-15 00:00:00.00020958.291161.41209.58951.83020006.46
422014-09-15 00:00:00.00020006.461161.41200.06961.35019045.11
432014-10-15 00:00:00.00019045.111161.41190.45970.96018074.15
442014-11-15 00:00:00.00018074.151161.41180.74980.67017093.48
452014-12-15 00:00:00.00017093.481161.41170.93990.48016103
462015-01-15 00:00:00.000161031161.41161.031000.38015102.62
472015-02-15 00:00:00.00015102.621161.41151.031010.38014092.24
482015-03-15 00:00:00.00014092.241161.41140.921020.49013071.75
492015-04-15 00:00:00.00013071.751161.41130.721030.69012041.06
502015-05-15 00:00:00.00012041.061161.41120.411041011000.06
512015-06-15 00:00:00.00011000.061161.411101051.4109948.65
522015-07-15 00:00:00.0009948.651161.4199.491061.9208886.73
532015-08-15 00:00:00.0008886.731161.4188.871072.5407814.19
542015-09-15 00:00:00.0007814.191161.4178.141083.2706730.92
552015-10-15 00:00:00.0006730.921161.4167.311094.105636.82
562015-11-15 00:00:00.0005636.821161.4156.371105.0404531.78
572015-12-15 00:00:00.0004531.781161.4145.321116.0903415.69
582016-01-15 00:00:00.0003415.691161.4134.161127.2502288.44
592016-02-15 00:00:00.0002288.441161.4122.881138.5301149.91
602016-03-15 00:00:00.0001149.911161.4111.51149.9100

In this example, the US Rule is applied, so there is no negative amortization. The monthly payment is 1160.82, and all other parameters are from the previous example.

SELECT *
FROM wct.LPMTSCHED(   50000,        --Present Value
                      '11/01/2010', --Loan Date
                      1160.82,      --Pmt
                      NULL,         --Rate
                      '04/15/2011', --First Payment Date
                      60,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      'U',          --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02010-11-01 00:00:00.0000000050000
12011-04-15 00:00:00.000500001160.821160.8201572.5450000
22011-05-15 00:00:00.000500001160.821160.820911.7250000
32011-06-15 00:00:00.000500001160.821160.820250.950000
42011-07-15 00:00:00.000500001160.82750.9409.92049590.08
52011-08-15 00:00:00.00049590.081160.82495.91664.91048925.17
62011-09-15 00:00:00.00048925.171160.82489.26671.56048253.61
72011-10-15 00:00:00.00048253.611160.82482.54678.28047575.33
82011-11-15 00:00:00.00047575.331160.82475.76685.06046890.27
92011-12-15 00:00:00.00046890.271160.82468.91691.91046198.36
102012-01-15 00:00:00.00046198.361160.82461.99698.83045499.53
112012-02-15 00:00:00.00045499.531160.82455705.82044793.71
122012-03-15 00:00:00.00044793.711160.82447.94712.88044080.83
132012-04-15 00:00:00.00044080.831160.82440.81720.01043360.82
142012-05-15 00:00:00.00043360.821160.82433.61727.21042633.61
152012-06-15 00:00:00.00042633.611160.82426.34734.48041899.13
162012-07-15 00:00:00.00041899.131160.82419741.82041157.31
172012-08-15 00:00:00.00041157.311160.82411.58749.24040408.07
182012-09-15 00:00:00.00040408.071160.82404.08756.74039651.33
192012-10-15 00:00:00.00039651.331160.82396.52764.3038887.03
202012-11-15 00:00:00.00038887.031160.82388.87771.95038115.08
212012-12-15 00:00:00.00038115.081160.82381.15779.67037335.41
222013-01-15 00:00:00.00037335.411160.82373.36787.46036547.95
232013-02-15 00:00:00.00036547.951160.82365.48795.34035752.61
242013-03-15 00:00:00.00035752.611160.82357.53803.29034949.32
252013-04-15 00:00:00.00034949.321160.82349.5811.32034138
262013-05-15 00:00:00.000341381160.82341.38819.44033318.56
272013-06-15 00:00:00.00033318.561160.82333.19827.63032490.93
282013-07-15 00:00:00.00032490.931160.82324.91835.91031655.02
292013-08-15 00:00:00.00031655.021160.82316.55844.27030810.75
302013-09-15 00:00:00.00030810.751160.82308.11852.71029958.04
312013-10-15 00:00:00.00029958.041160.82299.58861.24029096.8
322013-11-15 00:00:00.00029096.81160.82290.97869.85028226.95
332013-12-15 00:00:00.00028226.951160.82282.27878.55027348.4
342014-01-15 00:00:00.00027348.41160.82273.49887.33026461.07
352014-02-15 00:00:00.00026461.071160.82264.61896.21025564.86
362014-03-15 00:00:00.00025564.861160.82255.65905.17024659.69
372014-04-15 00:00:00.00024659.691160.82246.6914.22023745.47
382014-05-15 00:00:00.00023745.471160.82237.46923.36022822.11
392014-06-15 00:00:00.00022822.111160.82228.22932.6021889.51
402014-07-15 00:00:00.00021889.511160.82218.9941.92020947.59
412014-08-15 00:00:00.00020947.591160.82209.48951.34019996.25
422014-09-15 00:00:00.00019996.251160.82199.96960.86019035.39
432014-10-15 00:00:00.00019035.391160.82190.36970.46018064.93
442014-11-15 00:00:00.00018064.931160.82180.65980.17017084.76
452014-12-15 00:00:00.00017084.761160.82170.85989.97016094.79
462015-01-15 00:00:00.00016094.791160.82160.95999.87015094.92
472015-02-15 00:00:00.00015094.921160.82150.951009.87014085.05
482015-03-15 00:00:00.00014085.051160.82140.851019.97013065.08
492015-04-15 00:00:00.00013065.081160.82130.651030.17012034.91
502015-05-15 00:00:00.00012034.911160.82120.351040.47010994.44
512015-06-15 00:00:00.00010994.441160.82109.951050.8709943.57
522015-07-15 00:00:00.0009943.571160.8299.441061.3808882.19
532015-08-15 00:00:00.0008882.191160.8288.82107207810.19
542015-09-15 00:00:00.0007810.191160.8278.11082.7206727.47
552015-10-15 00:00:00.0006727.471160.8267.281093.5405633.93
562015-11-15 00:00:00.0005633.931160.8256.341104.4804529.45
572015-12-15 00:00:00.0004529.451160.8245.291115.5303413.92
582016-01-15 00:00:00.0003413.921160.8234.141126.6802287.24
592016-02-15 00:00:00.0002287.241160.8222.871137.9501149.29
602016-03-15 00:00:00.0001149.291160.7811.491149.2900

In this example, we have a 7,125,000 loan that pays monthly and is being amortized over 25 years, but the loan is paid off in full at the end of 10 years. The monthly payment is 41,554.10

SELECT *
FROM wct.LPMTSCHED(   7125000,      --Present Value
                      '11/18/2008', --Loan Date
                      41554.10,     --Pmt
                      NULL,         --Rate
                      '12/1/2008',  --First Payment Date
                      300,          --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      120           --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02008-11-18 00:00:00.000000007125000
12008-12-01 00:00:00.000712500041554.112864.5828689.5207096310.48
22009-01-01 00:00:00.0007096310.4841554.129567.9611986.1407084324.34
32009-02-01 00:00:00.0007084324.3441554.129518.0112036.0907072288.25
42009-03-01 00:00:00.0007072288.2541554.129467.8612086.2407060202.01
52009-04-01 00:00:00.0007060202.0141554.129417.512136.607048065.41
62009-05-01 00:00:00.0007048065.4141554.129366.9312187.1707035878.24
72009-06-01 00:00:00.0007035878.2441554.129316.1512237.9507023640.29
82009-07-01 00:00:00.0007023640.2941554.129265.1612288.9407011351.35
92009-08-01 00:00:00.0007011351.3541554.129213.9612340.1406999011.21
102009-09-01 00:00:00.0006999011.2141554.129162.5412391.5606986619.65
112009-10-01 00:00:00.0006986619.6541554.129110.9112443.1906974176.46
122009-11-01 00:00:00.0006974176.4641554.129059.0612495.0406961681.42
132009-12-01 00:00:00.0006961681.4241554.12900712547.106949134.32
142010-01-01 00:00:00.0006949134.3241554.128954.7212599.3806936534.94
152010-02-01 00:00:00.0006936534.9441554.128902.2212651.8806923883.06
162010-03-01 00:00:00.0006923883.0641554.128849.5112704.5906911178.47
172010-04-01 00:00:00.0006911178.4741554.128796.5712757.5306898420.94
182010-05-01 00:00:00.0006898420.9441554.128743.4212810.6806885610.26
192010-06-01 00:00:00.0006885610.2641554.128690.0412864.0606872746.2
202010-07-01 00:00:00.0006872746.241554.128636.4412917.6606859828.54
212010-08-01 00:00:00.0006859828.5441554.128582.6112971.4906846857.05
222010-09-01 00:00:00.0006846857.0541554.128528.5713025.5306833831.52
232010-10-01 00:00:00.0006833831.5241554.128474.2913079.8106820751.71
242010-11-01 00:00:00.0006820751.7141554.128419.7913134.3106807617.4
252010-12-01 00:00:00.0006807617.441554.128365.0713189.0306794428.37
262011-01-01 00:00:00.0006794428.3741554.128310.1113243.9906781184.38
272011-02-01 00:00:00.0006781184.3841554.128254.9313299.1706767885.21
282011-03-01 00:00:00.0006767885.2141554.128199.5213354.5806754530.63
292011-04-01 00:00:00.0006754530.6341554.128143.8713410.2306741120.4
302011-05-01 00:00:00.0006741120.441554.12808813466.106727654.3
312011-06-01 00:00:00.0006727654.341554.128031.8913522.2106714132.09
322011-07-01 00:00:00.0006714132.0941554.127975.5513578.5506700553.54
332011-08-01 00:00:00.0006700553.5441554.127918.9713635.1306686918.41
342011-09-01 00:00:00.0006686918.4141554.127862.1613691.9406673226.47
352011-10-01 00:00:00.0006673226.4741554.127805.1113748.9906659477.48
362011-11-01 00:00:00.0006659477.4841554.127747.8213806.2806645671.2
372011-12-01 00:00:00.0006645671.241554.127690.2913863.8106631807.39
382012-01-01 00:00:00.0006631807.3941554.127632.5313921.5706617885.82
392012-02-01 00:00:00.0006617885.8241554.127574.5213979.5806603906.24
402012-03-01 00:00:00.0006603906.2441554.127516.2714037.8306589868.41
412012-04-01 00:00:00.0006589868.4141554.127457.7814096.3206575772.09
422012-05-01 00:00:00.0006575772.0941554.127399.0514155.0506561617.04
432012-06-01 00:00:00.0006561617.0441554.127340.0714214.0306547403.01
442012-07-01 00:00:00.0006547403.0141554.127280.8414273.2606533129.75
452012-08-01 00:00:00.0006533129.7541554.127221.3714332.7306518797.02
462012-09-01 00:00:00.0006518797.0241554.127161.6514392.4506504404.57
472012-10-01 00:00:00.0006504404.5741554.127101.6814452.4206489952.15
482012-11-01 00:00:00.0006489952.1541554.127041.4614512.6406475439.51
492012-12-01 00:00:00.0006475439.5141554.126980.9914573.1106460866.4
502013-01-01 00:00:00.0006460866.441554.126920.2714633.8306446232.57
512013-02-01 00:00:00.0006446232.5741554.126859.314694.806431537.77
522013-03-01 00:00:00.0006431537.7741554.126798.0714756.0306416781.74
532013-04-01 00:00:00.0006416781.7441554.126736.5914817.5106401964.23
542013-05-01 00:00:00.0006401964.2341554.126674.8514879.2506387084.98
552013-06-01 00:00:00.0006387084.9841554.126612.8514941.2506372143.73
562013-07-01 00:00:00.0006372143.7341554.126550.5915003.5106357140.22
572013-08-01 00:00:00.0006357140.2241554.126488.0815066.0206342074.2
582013-09-01 00:00:00.0006342074.241554.126425.315128.806326945.4
592013-10-01 00:00:00.0006326945.441554.126362.2715191.8306311753.57
602013-11-01 00:00:00.0006311753.5741554.126298.9715255.1306296498.44
612013-12-01 00:00:00.0006296498.4441554.126235.4115318.6906281179.75
622014-01-01 00:00:00.0006281179.7541554.126171.5815382.5206265797.23
632014-02-01 00:00:00.0006265797.2341554.126107.4815446.6206250350.61
642014-03-01 00:00:00.0006250350.6141554.126043.1215510.9806234839.63
652014-04-01 00:00:00.0006234839.6341554.125978.4915575.6106219264.02
662014-05-01 00:00:00.0006219264.0241554.125913.615640.506203623.52
672014-06-01 00:00:00.0006203623.5241554.125848.4315705.6706187917.85
682014-07-01 00:00:00.0006187917.8541554.125782.9915771.1106172146.74
692014-08-01 00:00:00.0006172146.7441554.125717.2715836.8306156309.91
702014-09-01 00:00:00.0006156309.9141554.125651.2915902.8106140407.1
712014-10-01 00:00:00.0006140407.141554.125585.0315969.0706124438.03
722014-11-01 00:00:00.0006124438.0341554.125518.4916035.6106108402.42
732014-12-01 00:00:00.0006108402.4241554.125451.6716102.4306092299.99
742015-01-01 00:00:00.0006092299.9941554.125384.5816169.5206076130.47
752015-02-01 00:00:00.0006076130.4741554.125317.2116236.8906059893.58
762015-03-01 00:00:00.0006059893.5841554.125249.5516304.5506043589.03
772015-04-01 00:00:00.0006043589.0341554.125181.6216372.4806027216.55
782015-05-01 00:00:00.0006027216.5541554.125113.416440.706010775.85
792015-06-01 00:00:00.0006010775.8541554.125044.916509.205994266.65
802015-07-01 00:00:00.0005994266.6541554.124976.1116577.9905977688.66
812015-08-01 00:00:00.0005977688.6641554.124907.0316647.0705961041.59
822015-09-01 00:00:00.0005961041.5941554.124837.6716716.4305944325.16
832015-10-01 00:00:00.0005944325.1641554.124768.0216786.0805927539.08
842015-11-01 00:00:00.0005927539.0841554.124698.0816856.0205910683.06
852015-12-01 00:00:00.0005910683.0641554.124627.8416926.2605893756.8
862016-01-01 00:00:00.0005893756.841554.124557.3216996.7805876760.02
872016-02-01 00:00:00.0005876760.0241554.124486.517067.605859692.42
882016-03-01 00:00:00.0005859692.4241554.124415.3817138.7205842553.7
892016-04-01 00:00:00.0005842553.741554.124343.9717210.1305825343.57
902016-05-01 00:00:00.0005825343.5741554.124272.2617281.8405808061.73
912016-06-01 00:00:00.0005808061.7341554.124200.2517353.8505790707.88
922016-07-01 00:00:00.0005790707.8841554.124127.9517426.1505773281.73
932016-08-01 00:00:00.0005773281.7341554.124055.3417498.7605755782.97
942016-09-01 00:00:00.0005755782.9741554.123982.4317571.6705738211.3
952016-10-01 00:00:00.0005738211.341554.123909.2117644.8905720566.41
962016-11-01 00:00:00.0005720566.4141554.123835.6917718.4105702848
972016-12-01 00:00:00.000570284841554.123761.8617792.2405685055.76
982017-01-01 00:00:00.0005685055.7641554.123687.7317866.3705667189.39
992017-02-01 00:00:00.0005667189.3941554.123613.2917940.8105649248.58
1002017-03-01 00:00:00.0005649248.5841554.123538.5318015.5705631233.01
1012017-04-01 00:00:00.0005631233.0141554.123463.4718090.6305613142.38
1022017-05-01 00:00:00.0005613142.3841554.123388.0918166.0105594976.37
1032017-06-01 00:00:00.0005594976.3741554.123312.418241.705576734.67
1042017-07-01 00:00:00.0005576734.6741554.123236.3918317.7105558416.96
1052017-08-01 00:00:00.0005558416.9641554.123160.0718394.0305540022.93
1062017-09-01 00:00:00.0005540022.9341554.123083.4318470.6705521552.26
1072017-10-01 00:00:00.0005521552.2641554.123006.4618547.6405503004.62
1082017-11-01 00:00:00.0005503004.6241554.122929.1818624.9205484379.7
1092017-12-01 00:00:00.0005484379.741554.122851.5818702.5205465677.18
1102018-01-01 00:00:00.0005465677.1841554.122773.6518780.4505446896.73
1112018-02-01 00:00:00.0005446896.7341554.122695.418858.705428038.03
1122018-03-01 00:00:00.0005428038.0341554.122616.8218937.2805409100.75
1132018-04-01 00:00:00.0005409100.7541554.122537.9219016.1805390084.57
1142018-05-01 00:00:00.0005390084.5741554.122458.6819095.4205370989.15
1152018-06-01 00:00:00.0005370989.1541554.122379.1219174.9805351814.17
1162018-07-01 00:00:00.0005351814.1741554.122299.2219254.8805332559.29
1172018-08-01 00:00:00.0005332559.2941554.122218.9919335.1105313224.18
1182018-09-01 00:00:00.0005313224.1841554.122138.4319415.6705293808.51
1192018-10-01 00:00:00.0005293808.5141554.122057.5319496.5705274311.94
1202018-11-01 00:00:00.0005274311.945296288.2421976.35274311.9400

If we wanted to produce a summary by year of the previous example, we could enter:

SELECT YEAR(date_pmt) as [YEAR],
       ROUND(SUM(amt_pmt), 2) as [Yearly Payments],
       ROUND(SUM(amt_int_pay), 2) as [Yearly Interest],
       ROUND(SUM(amt_prin_pay), 2) as [Yearly Principal]
FROM wct.LPMTSCHED(   7125000,      --Present Value
                      '11/18/2008', --Loan Date
                      41554.10,     --Pmt
                      NULL,         --Rate
                      '12/1/2008',  --First Payment Date
                      300,          --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      120           --Last Payment Number
                  )
GROUP BY YEAR(date_pmt)
ORDER BY 1;

This produces the following result.

YEARYearly PaymentsYearly InterestYearly Principal
200841554.112864.5828689.52
2009498649.2351473.04147176.16
2010498649.2343943.25154705.95
2011498649.2336028.22162620.98
2012498649.2327708.21170940.99
2013498649.2318962.55179686.65
2014498649.2309769.44188879.76
2015498649.2300106.01198543.19
2016498649.2289948.16208701.04
2017498649.2279270.62219378.58
20185711829.24246152.065465677.18

In this example, we will generate a schedule using an annual rate.

SELECT *
FROM wct.LPMTSCHED(   100000,       --Present Value
                      '2012-05-02', --Loan Date
                      NULL,         --Pmt
                      .18,          --Rate
                      '2012-06-01', --First Payment Date
                      12,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02012-05-02 00:00:00.00000000100000
12012-06-01 00:00:00.0001000009163.4814507713.48092286.52
22012-07-01 00:00:00.00092286.529163.481384.37779.18084507.34
32012-08-01 00:00:00.00084507.349163.481267.617895.87076611.47
42012-09-01 00:00:00.00076611.479163.481149.178014.31068597.16
52012-10-01 00:00:00.00068597.169163.481028.968134.52060462.64
62012-11-01 00:00:00.00060462.649163.48906.948256.54052206.1
72012-12-01 00:00:00.00052206.19163.48783.098380.39043825.71
82013-01-01 00:00:00.00043825.719163.48657.398506.09035319.62
92013-02-01 00:00:00.00035319.629163.48529.798633.69026685.93
102013-03-01 00:00:00.00026685.939163.48400.298763.19017922.74
112013-04-01 00:00:00.00017922.749163.48268.848894.6409028.1
122013-05-01 00:00:00.0009028.19163.52135.429028.100

Now, let's take the same loan, and see what happens if we keep the interest rate the same and round the payment up to 9200.

SELECT *
FROM wct.LPMTSCHED(   100000,       --Present Value
                      '2012-05-02', --Loan Date
                      9200,         --Pmt
                      .18,          --Rate
                      '2012-06-01', --First Payment Date
                      12,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02012-05-02 00:00:00.00000000100000
12012-06-01 00:00:00.00010000092001512.17687.9092312.1
22012-07-01 00:00:00.00092312.192001443.987756.02084556.08
32012-08-01 00:00:00.00084556.0892001322.667877.34076678.74
42012-09-01 00:00:00.00076678.7492001199.448000.56068678.18
52012-10-01 00:00:00.00068678.1892001074.298125.71060552.47
62012-11-01 00:00:00.00060552.479200947.198252.81052299.66
72012-12-01 00:00:00.00052299.669200818.098381.91043917.75
82013-01-01 00:00:00.00043917.759200686.988513.02035404.73
92013-02-01 00:00:00.00035404.739200553.818646.19026758.54
102013-03-01 00:00:00.00026758.549200418.578781.43017977.11
112013-04-01 00:00:00.00017977.119200281.28918.809058.31
122013-05-01 00:00:00.0009058.319200141.699058.3100

And here's what happens with the same loan, if we keep the payment at 9200 and make the rate NULL, so that the function will calculate the rate based on the input.

SELECT *
FROM wct.LPMTSCHED(   100000,       --Present Value
                      '2012-05-02', --Loan Date
                      9200,         --Pmt
                      NULL,         --Rate
                      '2012-06-01', --First Payment Date
                      12,           --Number of Payments
                      12,           --Payments per Year
                      NULL,         --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02012-05-02 00:00:00.00000000100000
12012-06-01 00:00:00.00010000092001512.17687.9092312.1
22012-07-01 00:00:00.00092312.192001443.987756.02084556.08
32012-08-01 00:00:00.00084556.0892001322.667877.34076678.74
42012-09-01 00:00:00.00076678.7492001199.448000.56068678.18
52012-10-01 00:00:00.00068678.1892001074.298125.71060552.47
62012-11-01 00:00:00.00060552.479200947.198252.81052299.66
72012-12-01 00:00:00.00052299.669200818.098381.91043917.75
82013-01-01 00:00:00.00043917.759200686.988513.02035404.73
92013-02-01 00:00:00.00035404.739200553.818646.19026758.54
102013-03-01 00:00:00.00026758.549200418.578781.43017977.11
112013-04-01 00:00:00.00017977.119200281.28918.809058.31
122013-05-01 00:00:00.0009058.319200141.699058.3100

In this example we generate the payment schedule for a 5-year, 75,000 loan which commences on Sep 15th, having a first payment date of Jan 1st and using the 365/360 interest basis.

SELECT *
FROM wct.LPMTSCHED(   75000,        --Present Value
                      '09/15/2022', --Loan Date
                      NULL,         --Pmt
                      .18,          --Rate
                      '01/01/2023', --First Payment Date
                      60,           --Number of Payments
                      12,           --Payments per Year
                      365360,       --Days In Year
                      0,            --Future Value
                      NULL,         --Intrule
                      2,            --Decimals
                      NULL          --Last Payment Number
                  );

This produces the following result.

num_pmtdate_pmtamt_prin_initamt_pmtamt_int_payamt_prin_payamt_int_defamt_prin_end
02022-09-15 00:00:00.0000000075000
12023-01-01 00:00:00.000750001987.774050-2062.23077062.23
22023-02-01 00:00:00.00077062.231987.771194.46793.31076268.92
32023-03-01 00:00:00.00076268.921987.771067.76920.01075348.91
42023-04-01 00:00:00.00075348.911987.771167.91819.86074529.05
52023-05-01 00:00:00.00074529.051987.771117.94869.83073659.22
62023-06-01 00:00:00.00073659.221987.771141.72846.05072813.17
72023-07-01 00:00:00.00072813.171987.771092.2895.57071917.6
82023-08-01 00:00:00.00071917.61987.771114.72873.05071044.55
92023-09-01 00:00:00.00071044.551987.771101.19886.58070157.97
102023-10-01 00:00:00.00070157.971987.771052.37935.4069222.57
112023-11-01 00:00:00.00069222.571987.771072.95914.82068307.75
122023-12-01 00:00:00.00068307.751987.771024.62963.15067344.6
132024-01-01 00:00:00.00067344.61987.771043.84943.93066400.67
142024-02-01 00:00:00.00066400.671987.771029.21958.56065442.11
152024-03-01 00:00:00.00065442.111987.77948.911038.86064403.25
162024-04-01 00:00:00.00064403.251987.77998.25989.52063413.73
172024-05-01 00:00:00.00063413.731987.77951.211036.56062377.17
182024-06-01 00:00:00.00062377.171987.77966.851020.92061356.25
192024-07-01 00:00:00.00061356.251987.77920.341067.43060288.82
202024-08-01 00:00:00.00060288.821987.77934.481053.29059235.53
212024-09-01 00:00:00.00059235.531987.77918.151069.62058165.91
222024-10-01 00:00:00.00058165.911987.77872.491115.28057050.63
232024-11-01 00:00:00.00057050.631987.77884.281103.49055947.14
242024-12-01 00:00:00.00055947.141987.77839.211148.56054798.58
252025-01-01 00:00:00.00054798.581987.77849.381138.39053660.19
262025-02-01 00:00:00.00053660.191987.77831.731156.04052504.15
272025-03-01 00:00:00.00052504.151987.77735.061252.71051251.44
282025-04-01 00:00:00.00051251.441987.77794.41193.37050058.07
292025-05-01 00:00:00.00050058.071987.77750.871236.9048821.17
302025-06-01 00:00:00.00048821.171987.77756.731231.04047590.13
312025-07-01 00:00:00.00047590.131987.77713.851273.92046316.21
322025-08-01 00:00:00.00046316.211987.77717.91269.87045046.34
332025-09-01 00:00:00.00045046.341987.77698.221289.55043756.79
342025-10-01 00:00:00.00043756.791987.77656.351331.42042425.37
352025-11-01 00:00:00.00042425.371987.77657.591330.18041095.19
362025-12-01 00:00:00.00041095.191987.77616.431371.34039723.85
372026-01-01 00:00:00.00039723.851987.77615.721372.05038351.8
382026-02-01 00:00:00.00038351.81987.77594.451393.32036958.48
392026-03-01 00:00:00.00036958.481987.77517.421470.35035488.13
402026-04-01 00:00:00.00035488.131987.77550.071437.7034050.43
412026-05-01 00:00:00.00034050.431987.77510.761477.01032573.42
422026-06-01 00:00:00.00032573.421987.77504.891482.88031090.54
432026-07-01 00:00:00.00031090.541987.77466.361521.41029569.13
442026-08-01 00:00:00.00029569.131987.77458.321529.45028039.68
452026-09-01 00:00:00.00028039.681987.77434.621553.15026486.53
462026-10-01 00:00:00.00026486.531987.77397.31590.47024896.06
472026-11-01 00:00:00.00024896.061987.77385.891601.88023294.18
482026-12-01 00:00:00.00023294.181987.77349.411638.36021655.82
492027-01-01 00:00:00.00021655.821987.77335.671652.1020003.72
502027-02-01 00:00:00.00020003.721987.77310.061677.71018326.01
512027-03-01 00:00:00.00018326.011987.77256.561731.21016594.8
522027-04-01 00:00:00.00016594.81987.77257.221730.55014864.25
532027-05-01 00:00:00.00014864.251987.77222.961764.81013099.44
542027-06-01 00:00:00.00013099.441987.77203.041784.73011314.71
552027-07-01 00:00:00.00011314.711987.77169.721818.0509496.66
562027-08-01 00:00:00.0009496.661987.77147.21840.5707656.09
572027-09-01 00:00:00.0007656.091987.77118.671869.105786.99
582027-10-01 00:00:00.0005786.991987.7786.81900.9703886.02
592027-11-01 00:00:00.0003886.021987.7760.231927.5401958.48
602027-12-01 00:00:00.0001958.481987.8629.381958.4800