• crmitchell (7/25/2014)


    Coderx7 (7/24/2014)


    Evil Kraig F (7/24/2014)


    Coderx7 (7/24/2014)


    I really cant get the part to insert 1000 rows at once! How is that even possible? is it mot dangerous ? since it something happens you lose 1000 rows! not just 1, two or 100 rows, 1000 rows!

    That's the point - if something fails it rolls the whole thing back so you know what state the system is in and can just resubmit the same task. In the other case you have rolled back just the single insert and not the whole transaction. If you were looking to insert 1000 records you now need to work out where it failed and change your insert task to only insert those records after it failed and manual intervention is the surest way to have bugs creep in.

    Difference between SQL Server and Oracle.

    If you want to treat the loop inserting 1000 rows of data as a single transaction in SQL Server you need to explicitly define the transaction.

    BEGIN TRANSACTION

    your 1000 iteration loop

    COMMIT TRANSACTION

    Now, if you kill the process running this while still in the look, all rows entered up to the point you kill the process will be rolled back.