Note
If the REBUILD
option is run on a heap table (that is, a table with no clustered index), the rebuild operation does not affect the underlying table. Only the specified nonclustered indexes are rebuilt.
For added flexibility, you can also specify index options as part of the REBUILD
operation. The options available with the REBUILD
command are the same options available when you are creating indexes. The only exception is that the DROP EXISTING
option is not available with the REBUILD
operation. (Table 25.2, earlier in this chapter, provides detailed descriptions of the options.) The following example rebuilds the clustered index on the Production.Product
table and specifies several of the available REBUILD
options:
An alternative to the ...
Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.