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.
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.