Yeah I realized from all the postings that this subject has not been in the fore front, but as an avid T-SQL user I am tasked to create an amortization table for mortgage loans and that is how I came upon your logic. It works very well for what I need and you saved me from having to create it from scratch! I have tweaked the logic to display the loan number in the output, but I have a portfolio size of about 10,000 loans. I need this amortization created for each loan (which I will increase the size of my table by loan term of approx. 360 X 10,000), but its essential because this information is needed to be included in a mail merge I'm creating for borrowers.
Do you think it's possible to have the logic provide an amortization for each loan?
I saw you used these values when you created your loan table:
SELECT 1,GETDATE(),DATEADD(m,DATEDIFF(m,0,GETDATE())+2,0),360,.05,12,200000 UNION ALL
But it only populated 1 and not 2 from your UNION query.
Let me know your thoughts. Thanks in advance! Henry