• MAK-1128556 (8/18/2009)


    Thanks, so there is any script we have to find out how many indexes need to be defragment

    Yes. Lookup [font="Arial Black"]sys.dm_db_index_physical_stats [/font]and [font="Arial Black"]ALTER INDEX[/font] in Books Online to learn about the dozens of options before you trust anyone's script that you might be provided or that you might find. Understand it well before you use even one of the more well known scripts because such scripts seriously affect log files, database size, and the availability of data itself especially if you only have the Standard Edition or you have blobs in your data and you haven't made it to 2014 yet.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)