Create index query for all tables

  • Dear All

    I wan to to drop and recreate indexex on all tables using query.

    I have drop index syntax as follows

    SELECT 'drop index ' +i.name+ ' on ' +o.name

    FROM sys.indexes i

    JOIN sys.objects o ON i.object_id = o.object_id

    WHERE i.type_desc = 'NONCLUSTERED'

    AND o.type_desc = 'USER_TABLE'

    I would like to get the create index syntax using query. Can anybody help?

  • Many scripts available already in script section

    see link below for eg

    http://www.sqlservercentral.com/scripts/Indexing/94375/

    ----------------------------------------------------------------------------------------------------------------------------------------------------
    Roshan Joe

    Jeff Moden -Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • thank for the link. That what i wanted.

    I am using bcp command for puting data (minimumn 15 million rows) in such case is it better to use

    1) disable and rebuild index or 2) drop index and recreate

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply