USE Northwind EXEC sp_MSforeachtable @command1="DBCC DBREINDEX ('?')">>Im looking for a Scripts that reindex all table on a database. I found some links but its a broken links. http://www.mssqlcity.com/Scripts/Maint/RebuildAllIndexes.sql do you have url for this script? or alternative? tnx
>USE Northwind >DECLARE tables CURSOR FOR > SELECT > dbOwnTable = DB_NAME()+'.'+USER_NAME( uid )+'.'+Name > FROM sysobjects WHERE type='U' >OPEN tables > >DECLARE @dbOwnTable varchar(400) > >FETCH NEXT FROM tables INTO @dbOwnTable > >WHILE @@FETCH_STATUS = 0 >BEGIN > DBCC DBREINDEX (@dbOwnTable) -- WITH NO_INFOMSGS > FETCH NEXT FROM tables INTO @dbOwnTable >END > >CLOSE tables >DEALLOCATE tables >GO >