DBCC DBREINDEX in Microsoft SQL Server

DBCC DBREINDEX

Rebuilds one or more indexes for a table in the specified database.

Syntax

DBCC DBREINDEX
(    'database.owner.table_name'
[ , index_name
[ , fillfactor ]
]
)

Remarks
DBCC DBREINDEX rebuilds an index for a table or all indexes defined for a table. By allowing an index to be rebuilt dynamically, indexes enforcing either PRIMARY KEY or UNIQUE constraints can be rebuilt without having to drop and re-create those constraints. This means an index can be rebuilt without knowing the table’s structure or constraints, which could occur after a bulk copy of data into the table.

Examples
A. Rebuild an index
This example rebuilds the clustered index with a fill factor of 80 on the authors table in the pubs database.

DBCC DBREINDEX ('pubs.dbo.authors', UPKCL_auidind, 80)

B. Rebuild all indexes
This example rebuilds all indexes on the authors table using a fill factor value
of 70.

DBCC DBREINDEX (authors, '', 70)

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.