views:

37

answers:

2

I have a task to do that will require me using a transaction to ensure that many inserts will be completed or the entire update rolled back.

I am concerned about the amount of data that needs to be inserted in this transaction and whether this will have a negative affect on the server.

We are looking at about 10,000 records in table1 and 60,0000 records into table2.

Is this safe to do in a single transaction?

+3  A: 

have you thought about using a bulk data loader like SSIS or the data import wizard that comes with sql server?

the data import wizard is pretty simple.

In management studio right click on the database you want to import data into. Then select tasks and import data. Follow the wizard prompts. If a record fails the whole transaction will fail.

I have loaded millions of records this way (and using SSIS).

thomas
but isn't it still make use of the same transaction engine? and if not, does it fail the entire thing if say record 60000 fails?
Itay Moav
yes, in my experience if one record fails it will rollback.
thomas
A: 

it is safe, however keep in mind that you might be blocking other users during that time. Also take a look at bcp or BULK INSERT to make the inserts faster

SQLMenace