Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Bulk Insert Vs Selective Insert

Author  Topic 

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-01-19 : 02:43:17
I have a large (ish) table (1800000 recs) that gets updated weekly and am wondering whether it is quicker to do a bulk insert (clear down the table then insert all records) as compared to inserting using a 'WHERE NOT EXIST' statement?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-19 : 03:06:36
Do the new insert contain all records? Or only new and updated records?



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-01-19 : 03:21:59
The insert currently contains all records, I was wondering whether it would run faster if it were set to insert only new and updated records?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-19 : 03:41:04
If the insert contains ALL records with current values, it will be faster to

1) Truncate the destination table
2) Insert all records with BCP or BULK INSERT



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

Bill_C
Constraint Violating Yak Guru

299 Posts

Posted - 2009-01-19 : 03:51:53
Thanks for your help.
Go to Top of Page
   

- Advertisement -