Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx" rel="nofollow noreferrer">SqlBulkCopy</a> class, it will be able to run through those 100K rows much faster than individual inserts.</p> <p>Oh, and if you can, I would urge you to implement a <a href="http://msdn.microsoft.com/en-us/library/system.data.idatareader.aspx" rel="nofollow noreferrer">IDataReader</a> capable class, to feed the <a href="http://msdn.microsoft.com/en-us/library/434atets.aspx" rel="nofollow noreferrer">SqlBulkCopy.WriteToServer(IDataReader)</a> method, this will allow you to produce data sequentially, one row at a time. If you are importing from a text file, as an example, building some <code>IEnumerable&lt;T&gt;</code> methods that uses <code>yield return</code> and converting it to a <a href="http://msdn.microsoft.com/en-us/library/system.data.idatareader.aspx" rel="nofollow noreferrer">IDataReader</a> object will allow you to feed data to the server very naturally.</p> <p>To counter the loss of rollback ability with BCP, you can transfer the data into a temporary table, and then execute normal <code>INSERT INTO</code> statements on the server afterwards, bulk-transferring the data from the temporary table into the production table, this will allow you to use a transaction for the last transfer part, and will still run a lot faster than your original individual insert statements.</p> <p>EDIT: and <a href="https://stackoverflow.com/questions/287708/best-practices-for-uploading-files-to-database#287749">Here's an example</a> (C#, but should be easy to convert to VB.Net) of the usage of the bulk load API.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload