• ALIF-662928 (3/3/2010)


    Hi,

    Does any one have a script to ENABLE and DISABLE all the Indexes for all the Tables of a particular database on sql server 2005.

    To disable

    select 'alter index ' +i.name+ ' on ' +o.name+ ' disable ' + CHAR(13)+Char(10)+';'

    From sys.indexes i

    Inner Join sys.objects o

    On o.object_id = i.object_id

    Where o.is_ms_shipped = 0

    And i.index_id >= 1

    To enable - REBUILD the indexes.

    Article to read:

    http://www.sqlservercentral.com/articles/Indexing/63533/

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events