rebuild all indexes sql server code example
Example: rebuild index sql server
In Object Explorer, Expand the database that contains the table on which you want to reorganize an index.
Expand the Tables folder.
Expand the table on which you want to reorganize an index.
Expand the Indexes folder.
Right-click the index you want to reorganize and select Rebuild.