BULK INSERT and VB.Net

M

Mythran

I wrote a program that uses the BULK INSERT statement. All goes well and
everything gets imported fine but the return results (rows affected) is
double what was actually inserted.

My application creates a format file (for bulk insert, by itself without
bcp) and creates a data file using an imported file from an ibm mainframe.
Before using BULK INSERT it took 22 minutes to complete, now it takes < 2
minutes. So, it's definately worth it. But I do have a couple of questions
about it before I check it all in and Label it.

1.) Why are the affected rows returned by SqlCommand.ExecuteNonQuery double
what was actually affected?

2.) Since it is bulk inserted, and there is a problem with, let's say, the
213,000th row, do all the rows get rolled back?

3.) When using BCP, it shows how many rows have been inserted, how do they
get the # of rows affected? If I used a dataset, I could use the
SqlDataAdapter to fire an event for this, but I'm not. I'm just using a
SqlCommand object to do my updates and setting the BULK INSERT data and
format vars in the sql statement.

Any and all help appreciated, thank you...

Mythran
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top