Logo

SQL Server AMORTSCHED Function

Updated 2023-10-10 14:24:37.143000

Description

Use the table-valued function AMORTSCHED to generate an amortization schedule for a loan. 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.

AMORTSCHED 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.

Syntax

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

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.

@Rate

the annual interest rate. @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.

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.
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).
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.

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 rate on the loan is 6 per cent.

SELECT *
FROM wct.AMORTSCHED(   50000,        --Loan Amount
                       '11/01/2010', --Loan Start Date
                       .06,          --Annual Interest Rate
                       '12/01/2010', --First Payment Date
                       60,           --Number of payments (5*12)
                       12,           --Number of payments per year
                       NULL,         --Days in year (defaults to 360)
                       NULL,         --FV (defaults to 0)
                       NULL          --IntRule (defaults to 'A' meaning actuarial)
                   );

This produces the following results.

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.640076471413250716.64007647142049283.3599235286
22011-01-01 00:00:00.00049283.3599235286966.640076471413246.416799617643720.223276853729048563.1366466749
32011-02-01 00:00:00.00048563.1366466749966.640076471413242.815683233374723.824393238043047839.3122534368
42011-03-01 00:00:00.00047839.3122534368966.640076471413239.196561267184727.443515204221047111.8687382326
52011-04-01 00:00:00.00047111.8687382326966.640076471413235.559343691163731.080732780232046380.7880054524
62011-05-01 00:00:00.00046380.7880054524966.640076471413231.903940027262734.736136444139045646.0518690082
72011-06-01 00:00:00.00045646.0518690082966.640076471413228.230259345041738.409817126332044907.6420518819
82011-07-01 00:00:00.00044907.6420518819966.640076471413224.538210259409742.101866212011044165.5401856699
92011-08-01 00:00:00.00044165.5401856699966.640076471413220.827700928349745.812375543035043419.7278101268
102011-09-01 00:00:00.00043419.7278101268966.640076471413217.098639050634749.541437420761042670.1863727061
112011-10-01 00:00:00.00042670.1863727061966.640076471413213.35093186353753.289144607879041916.8972280982
122011-11-01 00:00:00.00041916.8972280982966.640076471413209.584486140491757.055590330892041159.8416377673
132011-12-01 00:00:00.00041159.8416377673966.640076471413205.799208188837760.840868282568040399.0007694847
142012-01-01 00:00:00.00040399.0007694847966.640076471413201.995003847424764.645072623964039634.3556968608
152012-02-01 00:00:00.00039634.3556968608966.640076471413198.171778484304768.468297987092038865.8873988737
162012-03-01 00:00:00.00038865.8873988737966.640076471413194.329436994368772.310639477037038093.5767593966
172012-04-01 00:00:00.00038093.5767593966966.640076471413190.467883796983776.172192674429037317.4045667222
182012-05-01 00:00:00.00037317.4045667222966.640076471413186.587022833611780.053053637763036537.3515130845
192012-06-01 00:00:00.00036537.3515130845966.640076471413182.686757565422783.95331890598035753.3981941785
202012-07-01 00:00:00.00035753.3981941785966.640076471413178.766990970892787.873085500498034965.525108678
212012-08-01 00:00:00.00034965.525108678966.640076471413174.82762554339791.812450928017034173.71265775
222012-09-01 00:00:00.00034173.71265775966.640076471413170.86856328875795.771513182634033377.9411445673
232012-10-01 00:00:00.00033377.9411445673966.640076471413166.889705722837799.75037074857032578.1907738188
242012-11-01 00:00:00.00032578.1907738188966.640076471413162.890953869094803.749122602308031774.4416512164
252012-12-01 00:00:00.00031774.4416512164966.640076471413158.872208256082807.767868215313030966.6737830011
262013-01-01 00:00:00.00030966.6737830011966.640076471413154.833368915006811.806707556399030154.8670754447
272013-02-01 00:00:00.00030154.8670754447966.640076471413150.774335377224815.865741094167029339.0013343506
282013-03-01 00:00:00.00029339.0013343506966.640076471413146.695006671753819.945069799629028519.0562645509
292013-04-01 00:00:00.00028519.0562645509966.640076471413142.595281322755824.044795148642027695.0114694023
302013-05-01 00:00:00.00027695.0114694023966.640076471413138.475057347011828.165019124386026866.8464502779
312013-06-01 00:00:00.00026866.8464502779966.640076471413134.33423225139832.305844220002026034.5406060579
322013-07-01 00:00:00.00026034.5406060579966.640076471413130.17270303029836.467373441126025198.0732326168
332013-08-01 00:00:00.00025198.0732326168966.640076471413125.990366163084840.649710308295024357.4235223085
342013-09-01 00:00:00.00024357.4235223085966.640076471413121.787117611542844.852958859843023512.5705634486
352013-10-01 00:00:00.00023512.5705634486966.640076471413117.562852817243849.077223654182022663.4933397945
362013-11-01 00:00:00.00022663.4933397945966.640076471413113.317466698972853.322609772407021810.1707300221
372013-12-01 00:00:00.00021810.1707300221966.640076471413109.05085365011857.589222821283020952.5815072008
382014-01-01 00:00:00.00020952.5815072008966.640076471413104.762907536004861.877168935407020090.7043382654
392014-02-01 00:00:00.00020090.7043382654966.640076471413100.453521691327866.186554780055019224.5177834853
402014-03-01 00:00:00.00019224.5177834853966.64007647141396.1225889174266870.517487553978018354.0002959313
412014-04-01 00:00:00.00018354.0002959313966.64007647141391.7700014796567874.870074991737017479.1302209396
422014-05-01 00:00:00.00017479.1302209396966.64007647141387.395651104698879.244425366698016599.8857955729
432014-06-01 00:00:00.00016599.8857955729966.64007647141382.9994289778645883.640647493527015716.2451480794
442014-07-01 00:00:00.00015716.2451480794966.64007647141378.5812257403968888.058850730977014828.1862973484
452014-08-01 00:00:00.00014828.1862973484966.64007647141374.140931486742892.499144984649013935.6871523637
462014-09-01 00:00:00.00013935.6871523637966.64007647141369.6784357618187896.961640709591013038.7255116542
472014-10-01 00:00:00.00013038.7255116542966.64007647141365.1936275582708901.44644891311012137.279062741
482014-11-01 00:00:00.00012137.279062741966.64007647141360.6863953137052905.953681157693011231.3253815834
492014-12-01 00:00:00.00011231.3253815834966.64007647141356.1566269079168910.48344956347010320.8419320199
502015-01-01 00:00:00.00010320.8419320199966.64007647141351.6042096600994915.035866811309405.80606520858
512015-02-01 00:00:00.0009405.80606520858966.64007647141347.0290303260429919.61104614537508486.19501906321
522015-03-01 00:00:00.0008486.19501906321966.64007647141342.430975095316924.20910137604907561.98591768716
532015-04-01 00:00:00.0007561.98591768716966.64007647141337.8099295884358928.8301468829606633.1557708042
542015-05-01 00:00:00.0006633.1557708042966.64007647141333.165778854021933.47429761737205699.68147318682
552015-06-01 00:00:00.0005699.68147318682966.64007647141328.4984073659341938.14166910548904761.53980408133
562015-07-01 00:00:00.0004761.53980408133966.64007647141323.8076990204067942.83237745097103818.70742663036
572015-08-01 00:00:00.0003818.70742663036966.64007647141319.0935371331518947.5465393382502871.16088729211
582015-09-01 00:00:00.0002871.16088729211966.64007647141314.3558044364606952.28427203493501918.87661525718
592015-10-01 00:00:00.0001918.87661525718966.6400764714139.59438307628589957.0456933950960961.830921862083
602015-11-01 00:00:00.000961.830921862083966.6400764714134.80915460931041961.83092186208300

This is an example of a loan that negatively amortizes principal using the actuarial rule.

SELECT *
FROM wct.AMORTSCHED(   50000,        --Loan Amount
                       '11/01/2010', --Loan Start Date
                       .12,          --Annual Interest Rate
                       '04/15/2011', --First Payment Date
                       60,           --Number of payments (5*12)
                       12,           --Number of payments per year
                       NULL,         --Days in year (defaults to 360)
                       NULL,         --FV (defaults to 0)
                       NULL          --IntRule (defaults to 'A' meaning actuarial)
                   );

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.409776815662733.33333333333-1571.92355651766051571.9235565177
22011-05-15 00:00:00.00051571.92355651771161.40977681566515.719235565177645.690541250478050926.2330152672
32011-06-15 00:00:00.00050926.23301526721161.40977681566509.262330152672652.14744666301050274.0855686042
42011-07-15 00:00:00.00050274.08556860421161.40977681566502.740855686042658.668921129611049615.4166474746
52011-08-15 00:00:00.00049615.41664747461161.40977681566496.154166474746665.255610340915048950.1610371337
62011-09-15 00:00:00.00048950.16103713371161.40977681566489.501610371336671.908166444322048278.2528706893
72011-10-15 00:00:00.00048278.25287068931161.40977681566482.782528706893678.62724810878047599.6256225805
82011-11-15 00:00:00.00047599.62562258051161.40977681566475.996256225806685.413520589864046914.2121019907
92011-12-15 00:00:00.00046914.21210199071161.40977681566469.142121019907692.267655795738046221.9444461949
102012-01-15 00:00:00.00046221.94444619491161.40977681566462.219444461949699.190332353712045522.7541138412
112012-02-15 00:00:00.00045522.75411384121161.40977681566455.227541138412706.182235677268044816.571878164
122012-03-15 00:00:00.00044816.5718781641161.40977681566448.16571878164713.244058034019044103.3278201299
132012-04-15 00:00:00.00044103.32782012991161.40977681566441.033278201299720.376498614358043382.9513215156
142012-05-15 00:00:00.00043382.95132151561161.40977681566433.829513215156727.580263600517042655.3710579151
152012-06-15 00:00:00.00042655.37105791511161.40977681566426.553710579151734.856066236513041920.5149916786
162012-07-15 00:00:00.00041920.51499167861161.40977681566419.205149916786742.204626898871041178.3103647797
172012-08-15 00:00:00.00041178.31036477971161.40977681566411.783103647797749.62667316787040428.6836916118
182012-09-15 00:00:00.00040428.68369161181161.40977681566404.286836916118757.122939899542039671.5607517123
192012-10-15 00:00:00.00039671.56075171231161.40977681566396.715607517123764.694169298549038906.8665824137
202012-11-15 00:00:00.00038906.86658241371161.40977681566389.068665824137772.341110991525038134.5254714222
212012-12-15 00:00:00.00038134.52547142221161.40977681566381.345254714222780.064522101435037354.4609493208
222013-01-15 00:00:00.00037354.46094932081161.40977681566373.544609493208787.865167322467036566.5957819983
232013-02-15 00:00:00.00036566.59578199831161.40977681566365.665957819983795.743818995667035770.8519630026
242013-03-15 00:00:00.00035770.85196300261161.40977681566357.708519630026803.701257185639034967.150705817
252013-04-15 00:00:00.00034967.1507058171161.40977681566349.67150705817811.738269757501034155.4124360595
262013-05-15 00:00:00.00034155.41243605951161.40977681566341.554124360595819.855652455066033335.5567836044
272013-06-15 00:00:00.00033335.55678360441161.40977681566333.355567836044828.054208979622032507.5025746248
282013-07-15 00:00:00.00032507.50257462481161.40977681566325.075025746248836.334751069418031671.1678235554
292013-08-15 00:00:00.00031671.16782355541161.40977681566316.711678235554844.698098580098030826.4697249753
302013-09-15 00:00:00.00030826.46972497531161.40977681566308.264697249753853.145079565918029973.3246454094
312013-10-15 00:00:00.00029973.32464540941161.40977681566299.733246454094861.676530361568029111.6481150478
322013-11-15 00:00:00.00029111.64811504781161.40977681566291.116481150478870.293295665189028241.3548193826
332013-12-15 00:00:00.00028241.35481938261161.40977681566282.413548193826878.996228621829027362.3585907608
342014-01-15 00:00:00.00027362.35859076081161.40977681566273.623585907608887.78619090806026474.5723998527
352014-02-15 00:00:00.00026474.57239985271161.40977681566264.745723998527896.664052817145025577.9083470356
362014-03-15 00:00:00.00025577.90834703561161.40977681566255.779083470356905.630693345298024672.2776536903
372014-04-15 00:00:00.00024672.27765369031161.40977681566246.722776536903914.687000278769023757.5906534115
382014-05-15 00:00:00.00023757.59065341151161.40977681566237.575906534115923.833870281549022833.75678313
392014-06-15 00:00:00.00022833.756783131161.40977681566228.3375678313933.072208984355021900.6845741456
402014-07-15 00:00:00.00021900.68457414561161.40977681566219.006845741456942.402931074212020958.2816430714
412014-08-15 00:00:00.00020958.28164307141161.40977681566209.582816430714951.826960384962020006.4546826864
422014-09-15 00:00:00.00020006.45468268641161.40977681566200.064546826864961.34522998879019045.1094526976
432014-10-15 00:00:00.00019045.10945269761161.40977681566190.451094526976970.958682288689018074.150770409
442014-11-15 00:00:00.00018074.1507704091161.40977681566180.74150770409980.66826911156017093.4825012974
452014-12-15 00:00:00.00017093.48250129741161.40977681566170.934825012974990.474951802702016103.0075494947
462015-01-15 00:00:00.00016103.00754949471161.40977681566161.0300754949471000.37970132071015102.627848174
472015-02-15 00:00:00.00015102.6278481741161.40977681566151.026278481741010.38349833394014092.24434984
482015-03-15 00:00:00.00014092.244349841161.40977681566140.92244349841020.48733331727013071.7570165228
492015-04-15 00:00:00.00013071.75701652281161.40977681566130.7175701652281030.69220665044012041.0648098723
502015-05-15 00:00:00.00012041.06480987231161.40977681566120.4106480987231040.99912871694011000.0656811554
512015-06-15 00:00:00.00011000.06568115541161.40977681566110.0006568115541051.4091200041109948.6565611513
522015-07-15 00:00:00.0009948.65656115131161.4097768156699.4865656115131061.9232112041408886.73334994716
532015-08-15 00:00:00.0008886.733349947161161.4097768156688.86733349947161072.542443316207814.19090663096
542015-09-15 00:00:00.0007814.190906630961161.4097768156678.14190906630961083.2678677493406730.92303888162
552015-10-15 00:00:00.0006730.923038881621161.4097768156667.30923038881621094.1005464268405636.82249245477
562015-11-15 00:00:00.0005636.822492454771161.4097768156656.36822492454771105.0415518911304531.78094056364
572015-12-15 00:00:00.0004531.780940563641161.4097768156645.31780940563641116.0919674100103415.68897315363
582016-01-15 00:00:00.0003415.688973153631161.4097768156634.15688973153631127.2528870841402288.43608606949
592016-02-15 00:00:00.0002288.436086069491161.4097768156622.88436086069491138.5254159549701149.91067011452
602016-03-15 00:00:00.0001149.910670114521161.4097768156611.49910670114521149.9106701145200

The same loan, except that the US Rule is applied, so there is no negative amortization.

SELECT *
FROM wct.AMORTSCHED(   50000,        --Loan Amount
                       '11/01/2010', --Loan Start Date
                       .12,          --Annual Interest Rate
                       '04/15/2011', --First Payment Date
                       60,           --Number of payments (5*12)
                       12,           --Number of payments per year
                       NULL,         --Days in year (defaults to 360)
                       NULL,         --FV (defaults to 0)
                       'U'           --IntRule (defaults to 'A' meaning actuarial)
                   );

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.816402971251160.8164029712501572.5169303620950000
22011-05-15 00:00:00.000500001160.816402971251160.816402971250911.7005273908450000
32011-06-15 00:00:00.000500001160.816402971251160.816402971250250.88412441959450000
42011-07-15 00:00:00.000500001160.81640297125750.884124419594409.932278551652049590.0677214483
52011-08-15 00:00:00.00049590.06772144831160.81640297125495.900677214483664.915725756763048925.1519956916
62011-09-15 00:00:00.00048925.15199569161160.81640297125489.251519956916671.564883014331048253.5871126772
72011-10-15 00:00:00.00048253.58711267721160.81640297125482.535871126772678.280531844474047575.3065808328
82011-11-15 00:00:00.00047575.30658083281160.81640297125475.753065808328685.063337162919046890.2432436699
92011-12-15 00:00:00.00046890.24324366991160.81640297125468.902432436699691.913970534548046198.3292731353
102012-01-15 00:00:00.00046198.32927313531160.81640297125461.983292731353698.833110239893045499.4961628954
112012-02-15 00:00:00.00045499.49616289541160.81640297125454.994961628954705.821441342292044793.6747215531
122012-03-15 00:00:00.00044793.67472155311160.81640297125447.936747215531712.879655755715044080.7950657974
132012-04-15 00:00:00.00044080.79506579741160.81640297125440.807950657974720.008452313272043360.7866134841
142012-05-15 00:00:00.00043360.78661348411160.81640297125433.607866134841727.208536836405042633.5780766477
152012-06-15 00:00:00.00042633.57807664771160.81640297125426.335780766477734.480622204769041899.097454443
162012-07-15 00:00:00.00041899.0974544431160.81640297125418.99097454443741.825428426817041157.2720260161
172012-08-15 00:00:00.00041157.27202601611160.81640297125411.572720260161749.243682711085040408.0283433051
182012-09-15 00:00:00.00040408.02834330511160.81640297125404.080283433051756.736119538196039651.2922237669
192012-10-15 00:00:00.00039651.29222376691160.81640297125396.512922237669764.303480733578038886.9887430333
202012-11-15 00:00:00.00038886.98874303331160.81640297125388.869887430333771.946515540914038115.0422274924
212012-12-15 00:00:00.00038115.04222749241160.81640297125381.150422274924779.665980696323037335.376246796
222013-01-15 00:00:00.00037335.3762467961160.81640297125373.353762467961787.462640503286036547.9136062928
232013-02-15 00:00:00.00036547.91360629281160.81640297125365.479136062928795.337266908319035752.5763393844
242013-03-15 00:00:00.00035752.57633938441160.81640297125357.525763393844803.290639577402034949.285699807
252013-04-15 00:00:00.00034949.2856998071160.81640297125349.49285699807811.323545973176034137.9621538339
262013-05-15 00:00:00.00034137.96215383391160.81640297125341.379621538339819.436781432908033318.525372401
272013-06-15 00:00:00.00033318.5253724011160.81640297125333.18525372401827.631149247237032490.8942231537
282013-07-15 00:00:00.00032490.89422315371160.81640297125324.908942231537835.907460739709031654.986762414
292013-08-15 00:00:00.00031654.9867624141160.81640297125316.54986762414844.266535347106030810.7202270669
302013-09-15 00:00:00.00030810.72022706691160.81640297125308.107202270669852.709200700577029958.0110263663
312013-10-15 00:00:00.00029958.01102636631160.81640297125299.580110263663861.236292707583029096.7747336587
322013-11-15 00:00:00.00029096.77473365871160.81640297125290.967747336587869.848655634659028226.9260780241
332013-12-15 00:00:00.00028226.92607802411160.81640297125282.269260780241878.547142191005027348.3789358331
342014-01-15 00:00:00.00027348.37893583311160.81640297125273.483789358331887.332613612916026461.0463222202
352014-02-15 00:00:00.00026461.04632222021160.81640297125264.610463222202896.205939749045025564.8403824711
362014-03-15 00:00:00.00025564.84038247111160.81640297125255.648403824711905.167999146535024659.6723833246
372014-04-15 00:00:00.00024659.67238332461160.81640297125246.596723833246914.219679138023745.4527041866
382014-05-15 00:00:00.00023745.45270418661160.81640297125237.454527041866923.361875929381022822.0908282572
392014-06-15 00:00:00.00022822.09082825721160.81640297125228.220908282572932.595494688674021889.4953335685
402014-07-15 00:00:00.00021889.49533356851160.81640297125218.894953335685941.921449635561020947.573883933
412014-08-15 00:00:00.00020947.5738839331160.81640297125209.47573883933951.340664131917019996.2332198011
422014-09-15 00:00:00.00019996.23321980111160.81640297125199.962332198011960.854070773236019035.3791490278
432014-10-15 00:00:00.00019035.37914902781160.81640297125190.353791490278970.462611480968018064.9165375469
442014-11-15 00:00:00.00018064.91653754691160.81640297125180.649165375469980.167237595778017084.7492999511
452014-12-15 00:00:00.00017084.74929995111160.81640297125170.847492999511989.968909971736016094.7803899793
462015-01-15 00:00:00.00016094.78038997931160.81640297125160.947803899793999.868599071453015094.9117909079
472015-02-15 00:00:00.00015094.91179090791160.81640297125150.9491179090791009.86728506217014085.0445058457
482015-03-15 00:00:00.00014085.04450584571160.81640297125140.8504450584571019.96595791279013065.0785479329
492015-04-15 00:00:00.00013065.07854793291160.81640297125130.6507854793291030.16561749192012034.912930441
502015-05-15 00:00:00.00012034.9129304411160.81640297125120.349129304411040.46727366684010994.4456567742
512015-06-15 00:00:00.00010994.44565677421160.81640297125109.9444565677421050.871946403509943.57371037067
522015-07-15 00:00:00.0009943.573710370671160.8164029712599.43573710370671061.3806658675408882.19304450313
532015-08-15 00:00:00.0008882.193044503131160.8164029712588.82193044503131071.9944725262207810.19857197691
542015-09-15 00:00:00.0007810.198571976911160.8164029712578.10198571976911082.7144172514806727.48415472544
552015-10-15 00:00:00.0006727.484154725441160.8164029712567.27484154725441093.5415614239905633.94259330144
562015-11-15 00:00:00.0005633.942593301441160.8164029712556.33942593301441104.4769770382304529.46561626321
572015-12-15 00:00:00.0004529.465616263211160.8164029712545.29465616263211115.5217468086103413.9438694546
582016-01-15 00:00:00.0003413.94386945461160.8164029712534.1394386945461126.676964276702287.2669051779
592016-02-15 00:00:00.0002287.26690517791160.8164029712522.8726690517791137.9437339194701149.32317125843
602016-03-15 00:00:00.0001149.323171258431160.8164029712511.49323171258431149.323171258660-2.31011654250324E-10

In this example, we have a loan with weekly payments, but we want to summarize the payment information into by month and year.

SELECT MONTH(date_pmt) as [MONTH],
       YEAR(date_pmt) as [YEAR],
       ROUND(SUM(amt_pmt), 2) as [Monthly Payments],
       ROUND(SUM(amt_int_pay), 2) as [Monthly Interest],
       ROUND(SUM(amt_prin_pay), 2) as [Monthly Principal]
FROM wct.AMORTSCHED(   50000,        --Loan Amount
                       '10/28/2010', --Loan Start Date
                       .12,          --Annual Interest Rate
                       '11/05/2010', --First Payment Date
                       156,          --Number of payments
                       52,           --Number of payments per year
                       NULL,         --Days in year (defaults to 360)
                       NULL,         --FV (defaults to 0)
                       NULL          --IntRule (defaults to 'A' meaning actuarial)
                   )
GROUP BY MONTH(date_pmt),
         YEAR(date_pmt)
ORDER BY 2,
         1;

This produces the following result.

MONTHYEARMonthly PaymentsMonthly InterestMonthly Principal
102010000
1120101527.44458.191069.24
1220101909.3556.831352.47
120111527.44434.211093.22
220111527.44424.121103.32
320111527.44413.921113.51
420111909.3502.931406.37
520111527.44390.651136.79
620111527.44380.151147.29
720111909.3460.271449.03
820111527.44356.161171.27
920111909.3429.981479.32
1020111527.44331.681195.76
1120111527.44320.631206.8
1220111909.3385.11524.19
120121527.44295.411232.03
220121527.44284.031243.41
320121909.3338.871570.43
420121527.44258.031269.4
520121527.44246.311281.13
620121909.3291.231618.07
720121527.44219.531307.91
820121909.3257.411651.89
920121527.44192.191335.25
1020121527.44179.851347.58
1120121909.3207.31702
1220121527.44151.681375.75
120131527.44138.971388.46
220131527.44126.151401.29
320131909.3139.471769.83
420131527.4496.861430.58
520131909.3102.471806.82
620131527.4466.951460.49
720131527.4453.461473.98
820131909.347.661861.63
920131527.4422.651504.79
1020131527.448.751518.69

This is an example of a loan with an odd first period with the same payment for every period where the interest is calculated using the actual number of days in the period divided by 360.

SELECT *
FROM wct.AMORTSCHED(   50000,        --Loan Amount
                       '11/01/2010', --Loan Start Date
                       .12,          --Annual Interest Rate
                       '04/15/2011', --First Payment Date
                       60,           --Number of payments (5*12)
                       12,           --Number of payments per year
                       365360,       --Days in year (defaults to 360)
                       NULL,         --FV (defaults to 0)
                       'A'           --IntRule (defaults to 'A' meaning actuarial)
                   );

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.000500001166.491417804982750-1583.50858219502051583.508582195
22011-05-15 00:00:00.00051583.5085821951166.49141780498515.83508582195650.656331983033050932.852250212
32011-06-15 00:00:00.00050932.8522502121166.49141780498526.306139918857640.185277886126050292.6669723259
42011-07-15 00:00:00.00050292.66697232591166.49141780498502.926669723259663.564748081725049629.1022242441
52011-08-15 00:00:00.00049629.10222424411166.49141780498512.834056317189653.657361487794048975.4448627563
62011-09-15 00:00:00.00048975.44486275631166.49141780498506.079596915149660.411820889834048315.0330418665
72011-10-15 00:00:00.00048315.03304186651166.49141780498483.150330418665683.341087386318047631.6919544802
82011-11-15 00:00:00.00047631.69195448021166.49141780498492.194150196295674.297267608688046957.3946868715
92011-12-15 00:00:00.00046957.39468687151166.49141780498469.573946868715696.917470936268046260.4772159352
102012-01-15 00:00:00.00046260.47721593521166.49141780498478.024931231331688.466486573653045572.0107293616
112012-02-15 00:00:00.00045572.01072936161166.49141780498470.910777536736695.580640268247044876.4300890933
122012-03-15 00:00:00.00044876.43008909331166.49141780498433.805490861235732.685926943748044143.7441621496
132012-04-15 00:00:00.00044143.74416214961166.49141780498456.152023008879710.339394796104043433.4047673535
142012-05-15 00:00:00.00043433.40476735351166.49141780498434.334047673535732.157370131449042701.247397222
152012-06-15 00:00:00.00042701.2473972221166.49141780498441.246223104628725.245194700356041976.0022025217
162012-07-15 00:00:00.00041976.00220252171166.49141780498419.760022025217746.731395779767041229.2708067419
172012-08-15 00:00:00.00041229.27080674191166.49141780498426.035798336333740.45561946865040488.8151872732
182012-09-15 00:00:00.00040488.81518727321166.49141780498418.384423601824748.10699420316039740.7081930701
192012-10-15 00:00:00.00039740.70819307011166.49141780498397.407081930701769.084335874282038971.6238571958
202012-11-15 00:00:00.00038971.62385719581166.49141780498402.70677985769763.784637947293038207.8392192485
212012-12-15 00:00:00.00038207.83921924851166.49141780498382.078392192485784.413025612498037423.426193636
222013-01-15 00:00:00.00037423.4261936361166.49141780498386.708737334239779.782680470744036643.6435131653
232013-02-15 00:00:00.00036643.64351316531166.49141780498378.650982969374787.840434835609035855.8030783297
242013-03-15 00:00:00.00035855.80307832971166.49141780498334.65416206441831.837255740573035023.9658225891
252013-04-15 00:00:00.00035023.96582258911166.49141780498361.914313500087804.577104304896034219.3887182842
262013-05-15 00:00:00.00034219.38871828421166.49141780498342.193887182842824.297530622141033395.0911876621
272013-06-15 00:00:00.00033395.09118766211166.49141780498345.082608939175821.408808865809032573.6823787962
282013-07-15 00:00:00.00032573.68237879621166.49141780498325.736823787962840.754594017021031732.9277847792
292013-08-15 00:00:00.00031732.92778477921166.49141780498327.906920442719838.584497362265030894.343287417
302013-09-15 00:00:00.00030894.3432874171166.49141780498319.241547303309847.249870501675030047.0934169153
312013-10-15 00:00:00.00030047.09341691531166.49141780498300.470934169153866.02048363583029181.0729332795
322013-11-15 00:00:00.00029181.07293327951166.49141780498301.537753643888864.953664161096028316.1192691184
332013-12-15 00:00:00.00028316.11926911841166.49141780498283.161192691184883.3302251138027432.7890440046
342014-01-15 00:00:00.00027432.78904400461166.49141780498283.472153454714883.01926435027026549.7697796543
352014-02-15 00:00:00.00026549.76977965431166.49141780498274.347621056428892.143796748556025657.6259829057
362014-03-15 00:00:00.00025657.62598290571166.49141780498239.471175840453927.02024196453024730.6057409412
372014-04-15 00:00:00.00024730.60574094121166.49141780498255.549592656392910.941825148591023819.6639157926
382014-05-15 00:00:00.00023819.66391579261166.49141780498238.196639157926928.294778647057022891.3691371456
392014-06-15 00:00:00.00022891.36913714561166.49141780498236.544147750504929.947270054479021961.4218670911
402014-07-15 00:00:00.00021961.42186709111166.49141780498219.614218670911946.877199134073021014.544667957
412014-08-15 00:00:00.00021014.5446679571166.49141780498217.150294902222949.341122902761020065.2035450542
422014-09-15 00:00:00.00020065.20354505421166.49141780498207.340436632227959.150981172756019106.0525638815
432014-10-15 00:00:00.00019106.05256388151166.49141780498191.060525638815975.430892166168018130.6216717153
442014-11-15 00:00:00.00018130.62167171531166.49141780498187.349757274392979.141660530592017151.4800111847
452014-12-15 00:00:00.00017151.48001118471166.49141780498171.514800111847994.976617693136016156.5033934916
462015-01-15 00:00:00.00016156.50339349161166.49141780498166.95053506608999.540882738904015156.9625107527
472015-02-15 00:00:00.00015156.96251075271166.49141780498156.6219459444441009.86947186054014147.0930388921
482015-03-15 00:00:00.00014147.09303889211166.49141780498132.039535029661034.45188277532013112.6411561168
492015-04-15 00:00:00.00013112.64115611681166.49141780498135.497291946541030.99412585844012081.6470302584
502015-05-15 00:00:00.00012081.64703025841166.49141780498120.8164703025841045.6749475024011035.972082756
512015-06-15 00:00:00.00011035.9720827561166.49141780498114.0383781884781052.453039616509983.51904313947
522015-07-15 00:00:00.0009983.519043139471166.4914178049899.83519043139471066.6562273735908916.86281576589
532015-08-15 00:00:00.0008916.862815765891166.4914178049892.14091576291411074.3505020420707842.51231372382
542015-09-15 00:00:00.0007842.512313723821166.4914178049881.03929390847941085.452123896506757.06018982731
552015-10-15 00:00:00.0006757.060189827311166.4914178049867.57060189827311098.9208159067105658.1393739206
562015-11-15 00:00:00.0005658.13937392061166.4914178049858.46744019717961108.023977607804550.1153963128
572015-12-15 00:00:00.0004550.11539631281166.4914178049845.5011539631281120.9902638418603429.12513247094
582016-01-15 00:00:00.0003429.125132470941166.4914178049835.43429303553311131.0571247694502298.06800770149
592016-02-15 00:00:00.0002298.068007701491166.4914178049823.74670274624881142.7447150587301155.32329264276
602016-03-15 00:00:00.0001155.323292642761166.4914178049811.16812516221331155.323292642770-1.00044417195022E-11