﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Discuss content posted by $sanjayattray / Article Discussions by Author  / Simple script to ReIndex complete database / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 20:59:55 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Simple script to ReIndex complete database</title><link>http://www.sqlservercentral.com/Forums/Topic401734-533-1.aspx</link><description>This is the same script without the overhead of the cursor and taking into account that views are also in the information_schema.tables view (and should not be returned byt the query:DECLARE @TableName varchar(255)SET @TableName = (SELECT TOP 1 TABLE_NAME FROM information_schema.tables WHERE table_name not like 'sys%' and table_name  &amp;lt;&amp;gt;'dtproperties' and TABLE_TYPE = 'BASE TABLE' order by TABLE_NAME asc)WHILE @TableName is not nullBEGIN 		PRINT 'Reindexing ' + @TableName		BEGIN TRY			DBCC DBREINDEX(@TableName,' ',0)-- change fill factor here as per your requirement		END TRY		BEGIN CATCH			PRINT 'Error reindexing ' + @TableName		END CATCH	SET @TableName = (SELECT TOP 1 TABLE_NAME FROM information_schema.tables WHERE table_name not like 'sys%' and table_name  &amp;lt;&amp;gt;'dtproperties' and TABLE_TYPE = 'BASE TABLE' and cast(table_name as varchar(255)) &amp;gt; @TableName order by TABLE_NAME asc)END</description><pubDate>Wed, 02 Apr 2008 10:39:20 GMT</pubDate><dc:creator>jmartin-697613</dc:creator></item><item><title>Simple script to ReIndex complete database</title><link>http://www.sqlservercentral.com/Forums/Topic401734-533-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Index+Management/31641/"&gt;Simple script to ReIndex complete database&lt;/A&gt;[/B]</description><pubDate>Sun, 23 Sep 2007 16:48:12 GMT</pubDate><dc:creator>SanjayAttray</dc:creator></item></channel></rss>