I developed this script in order to speedup datacopy operations. You can use this script to disable indexes or enabling them (by rebuilding the index).
This script only disables indexes which are added for performance considerations. Clustered indexes and key/constraint indexes are not touched. Execute this script in your actual database (no hardcoded database references).
Params:
- @objectname : Tablename
- @switch : determines disabling or enabling indexes 0 = disable, 1= enable
- @debug: when 1, only output is showed. no actual execution
- @verbose: when 1, additional information is showed
Warning: since there's no check on tabletype, you could alter system indexes.