This method uses an undocumented system proc. It works for SQL Sever
2000, but I'm not sure if this undocumented proc exists in SQL Server
2005:
use <your dbname>
go
EXEC sp_MSforeachtable @command1="print '?' DBCC DBREINDEX ('?')"
Go
- Chris
-----Original Message-----
From: BOUCHE Sylvain GBM
[mailto:mssqldba-ezmlmshield-x77013264.[Email address protected]
Sent: Friday, December 29, 2006 9: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
-----------------------------------------
This e-mail may contain confidential or privileged information. If
you think you have received this e-mail in error, please advise the
sender by reply e-mail and then delete this e-mail immediately.
Thank you. Aetna
MS Sql Server LazyDBA home page