We've had this error twice now from our C# code.
Nothing is changing the columns, but I've noticed though that it appears to happen when two threads are attempting to bulk insert into the same table, generally millions of rows.
The docs say that SqlBulkCopy.WriteToServer is not guaranteed to be thread-safe, but is this the problem here? It feels like it. I've seen some posts where people appeared to have experienced problems in similar circumstances (http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/85d51484-6381-46bc-bcce-63b58b362d2d).
There is no identity column just a non-unique clustered index that is (spid) process keyed to each thread.
Do I need to synchronise access to the table for WriteToServer - is this a known problem?
SqlException: Insert bulk failed due to a schema change of
the target table.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception,
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand
cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler,
View Complete Post