Reputation: 9565
I'm trying to improve the peformance of a call to SqlBulkCopy.WriteToServer(Datatable).
One of the suggestions I've seen is to temporarily disable the indexes on the table before the call to WriteToServer, and then enable the indexes afterwords.
I disable the table with this statement, ALTER INDEX 'IndexName' ON 'TableName' DISABLE
The problem I run into, is after I disable to the indexes and try to perform the write an error occurs with the statement, The query processor is unable to produce a plan because the index 'IndexName' on table or view 'TableName' is disabled.
Any ideas on how I can avoid this error or improve the write spends by some other means?
Upvotes: 4
Views: 1009
Reputation: 2594
You disabled the cluster index, instead of just non-cluster indices. Once Cluster index is disabled, you can not perform DML on table.
Upvotes: 3