Answered by:
rebuild the indexes

Question
-
can any one give me an idea how to rebuild the indexes on those tables which are not rebuild and how we will know that these are the tables which are not rebuild
thanks in advanceTuesday, December 15, 2009 8:05 PM
Answers
-
Hi Srikanth,
You can rebuild indexes using the Maintenance Wizard, or by running your own custom script via the SQL Server Agent or using DBCC DBREINDEX for each table.
Regards,
Ramakrishna- Proposed as answer by Ramakrishna Elashwarapu Wednesday, December 16, 2009 8:27 AM
- Marked as answer by Kalman Toth Saturday, December 26, 2009 4:09 PM
Tuesday, December 15, 2009 8:19 PM -
USE yourDatabase
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
Hope this help.
For reference to this answer visit this link click here :
- Proposed as answer by Silvers Rayleigh Wednesday, December 16, 2009 3:33 AM
- Marked as answer by Kalman Toth Saturday, December 26, 2009 4:09 PM
Wednesday, December 16, 2009 3:33 AM
All replies
-
Hi Srikanth,
You can rebuild indexes using the Maintenance Wizard, or by running your own custom script via the SQL Server Agent or using DBCC DBREINDEX for each table.
Regards,
Ramakrishna- Proposed as answer by Ramakrishna Elashwarapu Wednesday, December 16, 2009 8:27 AM
- Marked as answer by Kalman Toth Saturday, December 26, 2009 4:09 PM
Tuesday, December 15, 2009 8:19 PM -
USE yourDatabase
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
Hope this help.
For reference to this answer visit this link click here :
- Proposed as answer by Silvers Rayleigh Wednesday, December 16, 2009 3:33 AM
- Marked as answer by Kalman Toth Saturday, December 26, 2009 4:09 PM
Wednesday, December 16, 2009 3:33 AM