Tell me, how can I insert a large number of records at once from the C # code?
I know that there is BulkCopy, but are there any other options?
There is an option to generate VALUES and insert 1000 records, but will it not be slow? After all, a large string with a request can be sent to the server (Maybe I want to insert a hefty XML).
UPD
Found another option: http://www.sqlservercentral.com/blogs/nycnet/2012/05/11/one-way-to-insert-many-rows-very-fast-from-your-net-application/
The XML from which the insertion occurs is sent to the server to the procedure.
In theory, this allows you to insert over 1000 entries, but will not performance suffer?
BulkCopyI inserted about 200k records once a minute. Another optionBULK INSERTfrom a pre-prepared file. The difference in time within the measurement error. How often are you going to do a bulk insert? If less than once a minute, then in performance you are unlikely to be rested. But to insert lines one by one in a loop through LiNQ requests, with such a number, do not even think the server will be comfortable, but I did not wait for the completion of the task, I stopped forcibly. - rdornvaluesappreciable time will be spent on parsing the query text and compiling it. I think that insertion from XML will be faster thanvalues(except, perhaps, for the case when a very small number of records are inserted), andBulkCopywill be faster than XML-method. - i-one