If you have ever wanted to rebuild all the indexes on a table its pretty simple.
I have had to do this sometimes when troubleshooting a situation and not wanting to run a whole reindexing operation – just target in on one table.
Re-indexing can be a thankless task – remember it is best not to use the built in maintenance tasks if at all possible. Use a custom script that firstly checks for fragmentation levels and either rebuilds or reorganizes as required.
Here is the simple code.
ALTER INDEX ALL ON YourTableName REBUILD
There it is – Done.