RE: Rebuilding all indexes on all table

RE: Rebuilding all indexes on all table

 

  

EXECUTE sp_MSForEachTable @command1 ='ALTER INDEX ALL ON ?
REBUILD WITH (FILLFACTOR = 80, SORT_IN_TEMPDB = ON,
STATISTICS_NORECOMPUTE = OFF,
ONLINE = OFF);'

Note. You may want to change some options such as ONLINE set to ON, but
that depends on that datatypes in the indexes.

Rich

-----Original Message-----
From: BOUCHE Sylvain GBM
[mailto:mssqldba-ezmlmshield-x77013264.[Email address protected]
Sent: Friday, December 29, 2006 6:45 AM
To: LazyDBA Discussion
Subject: Rebuilding all indexes on all table

Hi,


Has anybody got a script for rebuiling all indexes on all tables in a
specified db using the ALTER INDEX statement?

Thanks,
Sylvain

************************************************************************
***********
The Royal Bank of Scotland plc. Registered in Scotland No 90312.
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB.
Authorised and regulated by the Financial Services Authority

This e-mail message is confidential and for use by the addressee only.
If the message is received by anyone other than the addressee, please
return the message to the sender by replying to it and then delete the
message from your computer. Internet e-mails are not necessarily secure.
The Royal Bank of Scotland plc does not accept responsibility for
changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of
viruses, it is the responsibility of the recipient to ensure that the
onward transmission, opening or use of this message and any attachments
will not adversely affect its systems or data. No responsibility is
accepted by The Royal Bank of Scotland plc in this regard and the
recipient should carry out such virus and other checks as it considers
appropriate.
Visit our websites at:
www.rbs.com
www.rbsgc.com
www.rbsmarkets.com
************************************************************************
***********


---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
The information contained in this electronic message is for the exclusive and confidential use of the addressee. Any other distribution, use, reproduction or alteration of the information contained in this electronic message, by the addressee or by any other recipient, without the prior written consent of the sender is strictly prohibited. If you have received this electronic message in error, please notify the sender.


MS Sql Server LazyDBA home page