View Single Post
Old 05-29-2015, 02:09 AM
JustinCase2 JustinCase2 is offline
Junior Contributor
Join Date: Apr 2006
Posts: 324
Default MSSQL - Insert > 1000 rows

When inserting rows to MSSQL, it has a limit of 1000 rows per statement. I have an import function that opens a text file With a special format, reads lots of logs from this, manipulates the data, and then inserts it into the database. I end up With about 1,500,000 records. Is there a way around the "only 1000 per statement" issue? It totally ruins the programs performance.
I have been looking for suggestions, but they all involve the import wizards etc., and i HAVE TO do it programatically.
I would prefer to bulk insert ALL the rows at once, but at the very least 10000-100000 per statement...

I have come across the bulk copy operation, but i am not sure how to use this when i do not have a matching table to get the data from, but generate it in-memory as a list of Objects.

Last edited by JustinCase2; 05-29-2015 at 02:17 AM.
Reply With Quote