Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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).

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.

Total article views: 1403 | Views in the last 30 days: 3
 
Related Articles
BLOG

SQL SERVER DISABLE INDEX

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

ARTICLE

Disabling Indexes

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

FORUM

Enable/Disable all indexes in all tables at once

Enable/Disable Indexes

FORUM

Disabling index by using select query

Disabling index by using select query

FORUM

How to Disable an index in sql server 2000

disable an index in sql svr 2000

Tags
indexing    
maintenance    
sql server 2005    
 
Contribute