How to read each row and update table

  • Arrears

    Credit Line Dates AvailableAmount Principal Interests Principal Interests

    0015321-01 31/01/2003 220,000 40,000 30,000 - -

    0015321-01 28/02/2003 - 40,000 30,000 - -

    0015321-01 31/03/2003 - 40,000 30,000 - -

    0015321-01 30/04/2003 - 40,000 30,000 30,000 30,000

    How can I fill Arrears(Principal and Interests) as shown above using sql server 2008.

    Available amount is used to pay for principal and Interests when the amount is over, arrears (Unpaid amount) is recorded.In this case 220 000 can pay (40 000+40 000+40 000+10 000 Principal)

    and (30 000+30 000+30 000 Interests)so principal for 30/04/2013 only 10 000 is paid and 30 000 becomes unpaid and 30 000 interests for 30/04/2013is wholly unpaid. Because 220 000 can not pay all.

  • edw_munya (5/27/2013)


    Arrears

    Credit Line Dates AvailableAmount Principal Interests Principal Interests

    0015321-01 31/01/2003 220,000 40,000 30,000 - -

    0015321-01 28/02/2003 - 40,000 30,000 - -

    0015321-01 31/03/2003 - 40,000 30,000 - -

    0015321-01 30/04/2003 - 40,000 30,000 30,000 30,000

    How can I fill Arrears(Principal and Interests) as shown above using sql server 2008.

    Available amount is used to pay for principal and Interests when the amount is over, arrears (Unpaid amount) is recorded.In this case 220 000 can pay (40 000+40 000+40 000+10 000 Principal)

    and (30 000+30 000+30 000 Interests)so principal for 30/04/2013 only 10 000 is paid and 30 000 becomes unpaid and 30 000 interests for 30/04/2013is wholly unpaid. Because 220 000 can not pay all.

    Hi and welcome to the forums. It is pretty much impossible to provide much help from what you have posted. We would need to see ddl (create table statements), sample data (insert statements) and desired output based on your sample data. If you post that there will be lots of people jumping in to help quickly.

    Please take a few minutes and read the first article in my signature for best practices when posting questions.

    _______________________________________________________________

    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/

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply