How to Insert Millions Records into Database Table
Suppose you need to insert millions of rows to database table. There are many ways that can accomplish this task fast, very fast or whatever. But the question is to perform the insert and not to produce locks on selects while the system is online and running which is more complicated. It should work the following way:
- create "proxy table"
- make batch load into it: either BCP or bulk insert or DTS
- move from "proxy table" into production via "insert into - select from", using partitioning (if there are millions of rows), to prevent locks on selects, for example additional identity field in "proxy table" would make partitioning easy.
Wednesday, September 15, 2004 3:05 AM