Open
Description
I m using Sqlbulkcopy with my application and trying to insert bulk 1000000 records in single table. But the approach is 10 Parallel threads will hit with bulk command on same table with 100000 record per each thread. while this thread ware running there will not be any update operation will happen on table. only read operation can happen same time from different thread.
using (SqlBulkCopy bulkCopy =
new SqlBulkCopy(connectionString, SqlBulkCopyOptions.KeepIdentity))
{
bulkCopy.DestinationTableName =
"dbo.BulkCopyDemoMatchingColumns";
try
{
// Write from the source to the destination.
bulkCopy.WriteToServer(reader);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
// Close the SqlDataReader. The SqlBulkCopy
// object is automatically closed at the end
// of the using block.
reader.Close();
}
I don't want any lock on my table and i also want to allow my all threads to bulk insert. I m using default option of bulk. how i can avoided Deadlock in this situation?