Disabling indexes for a SqlBulkCopy errors out

.net indexing sql sqlbulkcopy

Question

I'm working to make a call to SqlBulkCopy.WriteToServer(Datatable). perform better.

One recommendation I've read is to momentarily deactivate the table's indexes before using WriteToServer, and then re-enable them after.

This statement disables the table.ALTER INDEX 'IndexName' ON 'TableName' DISABLE

The issue I have is that when I deactivate the indexes and attempt to write, a statement error occurs.The query processor is unable to produce a plan because the index 'IndexName' on table or view 'TableName' is disabled.

Any suggestions on how I may prevent this mistake or enhance the write spends in any other way are welcome.

1
3
4/4/2013 6:17:06 PM

Accepted Answer

Instead of only disabling non-cluster indices, you also deactivated the cluster index. You cannot conduct DML operations on a table if a cluster index is deactivated.

3
4/4/2013 5:55:54 PM


Related Questions





Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow