Need Script in order to rebuild all indexes 
Author Message
 Need Script in order to rebuild all indexes
Hi,

I am new to this newsgroup so if this question has been answered, please
direct me to the answer.

I intend to setup a nightly task to "rebuild all indexes on all tables" on
1 database.  The help says that you have to specify the database and table.
 What is the T-SQL command to do this?

Remember, I need it to run on all indexes of every table withing a
database.  Please e-mail.    I will continue to browse this newsgroup to
get aquainted with MS-SQL.

Thanks...
Oscar....



Sun, 26 Aug 2001 03:00:00 GMT
 Need Script in order to rebuild all indexes

Here is my suggestion:

CREATE PROCEDURE Alle_Indizes_erneuern AS



DECLARE tnamen_cursor CURSOR FOR
 SELECT  u.name + '.'+ o.name
 FROM  sysobjects o,
  sysusers u
 WHERE  o.uid = u.uid
 AND type = 'U'
OPEN tnamen_cursor


BEGIN

 BEGIN




 END

END
PRINT " "
PRINT " "

   + "  *************"

PRINT " "
PRINT "Indices have been rebuild."
DEALLOCATE tnamen_cursor

GO

Please e-mail me your improvements!
Have a nice day,
Christoph

Oscar Santiesteban Jr. schrieb in Nachricht

Quote:
>Hi,

>I am new to this newsgroup so if this question has been answered, please
>direct me to the answer.

>I intend to setup a nightly task to "rebuild all indexes on all tables" on
>1 database.  The help says that you have to specify the database and table.
> What is the T-SQL command to do this?

>Remember, I need it to run on all indexes of every table withing a
>database.  Please e-mail.    I will continue to browse this newsgroup to
>get aquainted with MS-SQL.

>Thanks...
>Oscar....



Sun, 26 Aug 2001 03:00:00 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Script to rebuild indices

2. Script for rebuilding indexes

3. script to rebuild all indexes in a database?

4. Rebuild Field Index through Scripting?

5. Difference in ranking results from a full index rebuild verses an incremental rebuild

6. rebuild or not rebuild index file, when ?, how?

7. Is there a need to rebuild indexes after bulk insert operation

8. Need 2 rebuild indexes??

9. Need procedure to rebuild a system index

10. Why do Table Indexes Need Rebuilding?

11. Need Help With Index Rebuild


 
Powered by phpBB® Forum Software