Home Forums SQL Server 2005 T-SQL (SS2K5) Calculate Past Due Principal and Past Due Interest Based on Due Dates RE: Calculate Past Due Principal and Past Due Interest Based on Due Dates

  • OK so you tried to post some code but you missed the mark. The code you posted is full of syntax errors and variables not declared. There are columns referenced in your table that don't exist, etc. It seems you must have tried to simplify this but it just didn't work.

    I don't understand what you mean about calculating interest. There are a lot of ways to calculate interest and we still don't know how you are doing it.

    The while loop could be greatly simplified to a single insert statement instead of looping but getting this to work is incredibly difficult because none of the ddl supplied matches the insert and such. In short, if you can provide something that is more accurate we can help with the calculations but as it sits it doesn't work. As you provided it, it will not even compile.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/