Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Rebuilding index after truncation...

Author  Topic 

vamsimahi
Starting Member

29 Posts

Posted - 2008-09-22 : 12:45:44
I have a database with 10 tables. And each table has a index (there are clustered indices for three tables and non-clustered on the other tables). Every week I truncate all the data from these tables and load new data.

In this case, can I rebuild the indices using ALTER INDEX with REBUILD like:

ALTER INDEX ALL ON Table1
REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON,
STATISTICS_NORECOMPUTE = ON);

Or do I need to drop the indices before truncating the tables, than truncate the data and create the indices on the tables again.

Also, what does STATISTICS_NORECOMPUTE do, i am still confused after going through BOL.


Thanks.

jordanam
Yak Posting Veteran

62 Posts

Posted - 2008-09-22 : 13:50:59
Are you worried that your indexes from the table will disappear? During truncation, they don't. They will still exist.

What are you trying to accomplish? When there is no data in the table and it has been reset via truncation, your indexes are just as empty. You can't rebuild nothing, as far as I know (which isn't always much).
Go to Top of Page
   

- Advertisement -