We help IT Professionals succeed at work.

I just need to rebuild one table and one index

Rebuild  index on one table and one index.
I see alot of scripts to rebuild ALL indexes,

I just need to rebuild one table and one index ?

Metrics =  Database name
metrics_crs =  table name
STATUS =  index name

Thanks
fordraiders
Comment
Watch Question

Senior DBA
Most Valuable Expert 2018
Distinguished Expert 2019
Commented:
USE [Metrics];
ALTER INDEX [STATUS] ON metrics_crs REBUILD;
Raja Jegan RSQL Server DBA & Architect, EE Solution Guide
Awarded 2009
Distinguished Expert 2019

Commented:
Above one by Scott should be sufficient if you are quick starter..
If your metrics_crs table is huge and if your index size is also huge, then you would need to look into few more options listed below depending upon your SQL Server version, table whether it is compressed or not..
1. REBUILD WITH ONLINE = ON
2. ONLINE = ON
3. SORT_IN_TEMPDB = ON
4. PARTITION = partition_number

Complete info about the above parameters here..
https://docs.microsoft.com/en-us/sql/t-sql/statements/alter-index-transact-sql?view=sql-server-ver15

Author

Commented:
Thanks