Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

disable/enable indexes for table

By Wilfred van Dijk,

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


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

Total article views: 1398 | Views in the last 30 days: 2
Related Articles


Use the script below to disable an index on a SQL Server table ALTER INDEX MY_INDEX_NAME on MY_TABL...


Disabling Indexes

Expert SQL Server trainer Andy Warren brings us a new article on a lesser used feature in SQL server...


Enable/Disable all indexes in all tables at once

Enable/Disable Indexes


Disabling index by using select query

Disabling index by using select query


How to Disable an index in sql server 2000

disable an index in sql svr 2000

sql server 2005    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones