Bulk Insert into table - How to manage the transaction?

  • My scenario as follow,

    1. Thomas is a Ticket Agent for GSC Bus

    2. As Ticket Agent, he have a Prepaid.

    3. Let's say, his balance is $125.45

    4. Now, he perform purchasing 12 Ticket -- This process only click 1 submit button on front-end, front-end code will doing a looping to hit Stored Procedure

    4. Total Amount for 12 Ticket is $130.45 -- at this level, he exceed his prepaid

    My question is,

    1. How transaction can manage the Atomicity for this Bulk Insert (12 insert into the table)?

    2. Where to check the Total of Ticket Amount?

    3. Did i need to check the sum of the 12 ticket <= $125.45 at front-end first, then perform the transaction? or check the sum of the 12 ticket <= $125.45 at Back-end (Stored Procedure), then perform the transaction?

  • Since this sounds a whole lot like homework, I'd imagine that you won't get very much help unless you also show what you've tried in code and explain why. Personally, I have no problem helping folks achieve understanding on homework, but they have to try first.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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