Query to Rebuild Indexes on SQL Server 2000 Database

  • Hi,

    Can anyone please let me know the query to rebuild all the indexes in an SQL Server 2000 Database??

    I need to rebuild all the indexes in database at a time using single query.

    Thanks in advance,

    Vamshi.

  • You posted in a SQL 2008 forum. Not that you won't receive help, but you may have better luck posting your question in one of the SQL 2000 forums.

    http://www.sqlservercentral.com/Forums/Group406.aspx

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • No need to post yet again. I've asked the mod to move the thread.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • vamshi.sql (4/20/2011)


    Hi,

    Can anyone please let me know the query to rebuild all the indexes in an SQL Server 2000 Database??

    I need to rebuild all the indexes in database at a time using single query.

    Thanks in advance,

    Vamshi.

    Vamshi,

    You can get the script here.

    SQL server 2000 Index rebuild script[/url]

    Muthukkumaran Kaliyamoorthy
    https://www.sqlserverblogforum.com/

  • I found this useful bit of code :

    Run the following script changing the xxx for the database name, run against master.

    SELECT 'dbcc dbreindex(''xxxxxxx.DBO.' +name+ ''')'

    FROM sysobjects WHERE xtype='U'

    This will generate a rebuild statement for each index, copy the output from the results window and paste it to the QueryAnalyzer window and run against the right database. This can obviously be repeated for each database as required.

Viewing 5 posts - 1 through 4 (of 4 total)

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