• Akayisi (1/7/2014)


    Thanks a lot by the way i guess this is also working

    select 'ALTER INDEX '+sys.indexes.name+ ' ON '+sys.tables.name+' rebuild' from sys.indexes,sys.tables

    where sys.indexes.object_id=sys.tables.object_id

    and

    sys.indexes.name is not null

    This can work as long as you don't have more then 1 schema. Also this will create a script for all indexes on all the tables and not just one table as you asked in the original post.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/