• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

C# framework 3.5 :SQL Server 2000: SqlBulkCopy:WriteToServer: What happening while another process is executing on database?

I have an  sql server 2000 database.

I execute the following code:

SqlConnection conn_1 = null;

  conn_1 = new SqlConnection(_conn.ConnectionString);
                string str_ColumnTable;

                str_ColumnTable = string.Format("Columns_{0}", 1);
                if (conn_1.State == ConnectionState.Closed)

                using (SqlBulkCopy bcp = new SqlBulkCopy(conn_1))
                    bcp.DestinationTableName = str_ColumnTable;



I have also another application that deletes old records on the same database table on specific time.
I have the following question:
If the "delete"  application Starts, and on the same time the other application executes the specific code (...bcp.WriteToServer...), what happening?
By the way The delete operation has connection Time out 1800 seconds (on its connection string).
Yesterday I remark this:
First I delete records manually.
While deleting the records, the other program  executes  bcp.WriteToServer....
I have a record counter on interface of inserting program.I expect to put 500 records .
And the counter is stuck  in 8.I  was waiting for few seconds and then the application puts the rest 492 records.
I remark that on the same time the delete operation is complete.
So , if Delete operation is occur for example 20 minutes, can   bcp.WriteToServer --> wait for this time?
I read the opposite case:if    bcp.WriteToServer happens then no other operations happens concurrently.
But on specific case:  bcp.WriteToServer  puts  8 records -------wait deleting from another process--- complete  bcp.WriteToServer.
Could you please give some advices?

with regards ,
1 Solution
You can lock the table(s) but that may (and probably will) create deadlock problems.
nikavakAuthor Commented:

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now