Wednesday, January 4, 2012

Disable all indexes in sql server

For a data marting application being done @ SyneITY, we needed to disable all indexes in our Sql Server 2008 database. We used the following query to get this done

SELECT 'ALTER INDEX ' + I.name + ' ON ' + T.name + ' DISABLE ' FROM SYS.indexes I INNER JOIN SYS.tables T ON I.object_id = T.object_id


WHERE I.name LIKE 'IX%'

No comments:

Post a Comment