The Wrecking Bawl

Destructuring query language, one keyword at a time.


News


I just discovered the SqlBulkCopy class in .Net 2.0, and it seems awesome!  Now I don't have to shell out to BCP anymore!  We'll see though, I haven't done any performance testing yet...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Comments

Gravatar # re: SqlBulkCopy
Posted by AzamSharp on 4/10/2007 11:39 PM
Hi,

Check out my article on SqlBuildCopy.
http://gridviewguy.com/ArticleDetails.aspx?articleID=233
Gravatar # re: SqlBulkCopy
Posted by Alex Bransky on 4/10/2007 11:46 PM
Cool, thanks. Right now I'm using a DataTable that's built from a fixed-field text file, so it will be interesting to see what BatchSize works best.
Gravatar # re: SqlBulkCopy
Posted by Bruce Dunwiddie on 4/11/2007 1:26 PM
The batch size is going to make less of a difference than if you can eliminate the DataTable from the mix. You're wasting a lot of resources trying to load all the data into memory first instead of streaming the data to SqlBulkCopy directly from the file.
Gravatar # re: SqlBulkCopy
Posted by Alex Bransky on 4/11/2007 6:07 PM
I don't know how to parse the fields out directly to SqlBulkCopy without the DataTable in between.
Gravatar # re: SqlBulkCopy
Posted by Bruce Dunwiddie on 4/12/2007 7:16 PM
Check out my site and see how I go about it, FixedWidthDataReader in your case. I'm not saying I've got the only component that can do it, it just bugs me when I see solutions for large data that just changes the scaling metrics, doesn't necessarily provide a permanent fix. I'm pondering putting together a nice fully documented plea to MS that they start looking at enterprise level data scalability issues in a cross product line perspective as data mining and management is becoming a larger and larger issue that everyday developers are having to deal with without framework tools built for the job.
Gravatar # re: SqlBulkCopy
Posted by Alex Bransky on 4/17/2007 6:02 AM
FYI, one irritating thing about SqlBulkCopy (irritating if you don't know that it does it) is that you have to specify the identity column in your DataTable before you call WriteToServer, otherwise the columns will map incorrectly. If you want to write the values in the identity column to the db there's a KeepIdentity option.
Gravatar # re: SqlBulkCopy
Posted by web development company on 8/10/2009 8:39 PM
Humm... interesting,

I used bulkcopy class before, but I rarely use it any way

Thanks for writing, most people don't bother.
Gravatar # re: SqlBulkCopy
Posted by nike dunk sb space jam on 8/19/2011 1:33 PM
Thank trusted to talk about this. I believe very strong about and want to learn more. If it is determined, you gain additional insight, maybe you do not mind adding additional terms are very similar, of which more information? It would be very useful for me and my friends help.

Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: