Transaction questions

  • There are three store procedures. Each sp will get parameters from a asp.net project.
    Each sp will updat database.
    I applied transaction function for each sp so that allow return the database to a consistent state in case there is an error. 
    They are working fine.
    sp1: update master table
    sp2: update detail table
    sp3: update history table
    My final step need to do:

    Only sp1 ok and then run sp2, only sp1 and sp2 ok and then run sp3.

    Question:

    Is there any way to complete final step? Do I need to put all three sp to one and then apply transaction?

  • adonetok - Saturday, January 28, 2017 7:09 AM

    There are three store procedures. Each sp will get parameters from a asp.net project.
    Each sp will updat database.
    I applied transaction function for each sp so that allow return the database to a consistent state in case there is an error. 
    They are working fine.
    sp1: update master table
    sp2: update detail table
    sp3: update history table
    My final step need to do:

    Only sp1 ok and then run sp2, only sp1 and sp2 ok and then run sp3.

    Question:

    Is there any way to complete final step? Do I need to put all three sp to one and then apply transaction?

    If they all have to succeed or fail as a unit (they all succeed or they all fail - nothing partial), then you need to put them all in the same stored procedure, not 3 different ones.

  • pietlinden - Saturday, January 28, 2017 8:46 PM

    adonetok - Saturday, January 28, 2017 7:09 AM

    There are three store procedures. Each sp will get parameters from a asp.net project.
    Each sp will updat database.
    I applied transaction function for each sp so that allow return the database to a consistent state in case there is an error. 
    They are working fine.
    sp1: update master table
    sp2: update detail table
    sp3: update history table
    My final step need to do:

    Only sp1 ok and then run sp2, only sp1 and sp2 ok and then run sp3.

    Question:

    Is there any way to complete final step? Do I need to put all three sp to one and then apply transaction?

    If they all have to succeed or fail as a unit (they all succeed or they all fail - nothing partial), then you need to put them all in the same stored procedure, not 3 different ones.

    The number of parameters will be about 100 for all three sp. 
    Can I use try-catch-end instead of transactions?

  • This was removed by the editor as SPAM

Viewing 4 posts - 1 through 3 (of 3 total)

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