Thursday 19 June 2008

Import millions of records into SQL Server

In any mass import of data you need to do the following steps

1) Change the recovery mode to 'Bulk Logged' (or Simple if you dont have a backup strategy on the server)
2) Remove the indexes on the table (I would consider removing the Clustered and Non Clustered Indexes)
3) Import your 25 million records (I would try and do them in batches on 100,000 each to keep the tempdb from growing to big)
4) Reapply your indexes to your table
5) Change back your recovery mode on your database.

No comments: