insert more than 1000 rows into the sql server database from json in c code

You should insert each row one by one.

https://www.red-gate.com/simple-talk/sql/performance/comparing-multiple-rows-insert-vs-single-row-insert-with-three-data-load-methods/

Gist – 23 columns means inserting more than 2 at a time isn’t worth it. Time wise, single row inserts is almost as fast as multiple row inserts. There is a case where stringifying your parameters can give you a 50% boost, but IMO not worth it. If you reduce your columns to 2 or even 7 it might be worth it.

Take those estimates with a grain of salt – the performance of the box may affect the relative benefits.

Of course keeping your row inserts to one at a time makes it easy to parameterize your query and keep things clear while eliminating the potential of sql injection. Not having to compile the sql everytime, while doing most of the parameter work on the client can help a lot also.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top