<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; 2008 &#8211; 2005 &#8211; Rebuild Every Index of All Tables of Database &#8211; Rebuild Index with FillFactor</title>
	<atom:link href="http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:36:10 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Carl Saiyed</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-247153</link>
		<dc:creator><![CDATA[Carl Saiyed]]></dc:creator>
		<pubDate>Thu, 02 Feb 2012 19:21:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-247153</guid>
		<description><![CDATA[Thanks Pinal!]]></description>
		<content:encoded><![CDATA[<p>Thanks Pinal!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Correct Value for Fillfactor &#8211; Quiz &#8211; Puzzle &#8211; 24 of 31 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-243207</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Correct Value for Fillfactor &#8211; Quiz &#8211; Puzzle &#8211; 24 of 31 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Wed, 25 Jan 2012 01:32:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-243207</guid>
		<description><![CDATA[[...] What is the Best Value for Fill Factor Fillfactor, Index and In-depth Look at Effect on Performance Rebuild Every Index of All Tables of Database – Rebuild Index with FillFactor Change Default Fill Factor For Index Comparison Index Fragmentation, Index De-Fragmentation, Index [...]]]></description>
		<content:encoded><![CDATA[<p>[...] What is the Best Value for Fill Factor Fillfactor, Index and In-depth Look at Effect on Performance Rebuild Every Index of All Tables of Database – Rebuild Index with FillFactor Change Default Fill Factor For Index Comparison Index Fragmentation, Index De-Fragmentation, Index [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jens H. E.</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-221327</link>
		<dc:creator><![CDATA[Jens H. E.]]></dc:creator>
		<pubDate>Mon, 19 Dec 2011 11:41:21 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-221327</guid>
		<description><![CDATA[If you want to rebuild all indexes... this is by far the easiest way to do it:

EXEC sp_MSForEachTable &#039;Print &#039;&#039;Rebuild index on: ?&#039;&#039;; ALTER INDEX ALL ON ? REBUILD WITH (FILLFACTOR = 80);&#039;]]></description>
		<content:encoded><![CDATA[<p>If you want to rebuild all indexes&#8230; this is by far the easiest way to do it:</p>
<p>EXEC sp_MSForEachTable &#8216;Print &#8221;Rebuild index on: ?&#8221;; ALTER INDEX ALL ON ? REBUILD WITH (FILLFACTOR = 80);&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandesh</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-195326</link>
		<dc:creator><![CDATA[Sandesh]]></dc:creator>
		<pubDate>Mon, 14 Nov 2011 15:43:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-195326</guid>
		<description><![CDATA[How often should indexes rebuilded?]]></description>
		<content:encoded><![CDATA[<p>How often should indexes rebuilded?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Kacos</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-176490</link>
		<dc:creator><![CDATA[Mike Kacos]]></dc:creator>
		<pubDate>Sat, 08 Oct 2011 15:56:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-176490</guid>
		<description><![CDATA[Chris

Good call.  Pulled my hair out until I saw your response.  Spaces in table names was my issue.

Thanks]]></description>
		<content:encoded><![CDATA[<p>Chris</p>
<p>Good call.  Pulled my hair out until I saw your response.  Spaces in table names was my issue.</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-172619</link>
		<dc:creator><![CDATA[Rick]]></dc:creator>
		<pubDate>Tue, 27 Sep 2011 22:09:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-172619</guid>
		<description><![CDATA[Dave, 

You&#039;re awesome. When I google-search any SQL Server-related topic and I see sqlauthority in the results, I know my answer lies in a very concisely-worded article that gets the job done. I also look forward to seeing your picture at the top of the browser window squinting at me as if to say, &quot;You&#039;re here again? Why do you even still have your job!?!?&quot;

Please keep up the great work.

Rick]]></description>
		<content:encoded><![CDATA[<p>Dave, </p>
<p>You&#8217;re awesome. When I google-search any SQL Server-related topic and I see sqlauthority in the results, I know my answer lies in a very concisely-worded article that gets the job done. I also look forward to seeing your picture at the top of the browser window squinting at me as if to say, &#8220;You&#8217;re here again? Why do you even still have your job!?!?&#8221;</p>
<p>Please keep up the great work.</p>
<p>Rick</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bison</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-159545</link>
		<dc:creator><![CDATA[Bison]]></dc:creator>
		<pubDate>Fri, 19 Aug 2011 15:36:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-159545</guid>
		<description><![CDATA[&quot;...answer is I just think having it 80 will do the job...&quot; 
WOW Very convincing!
Thanks!]]></description>
		<content:encoded><![CDATA[<p>&#8220;&#8230;answer is I just think having it 80 will do the job&#8230;&#8221;<br />
WOW Very convincing!<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sujeet</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-150977</link>
		<dc:creator><![CDATA[Sujeet]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 06:44:23 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-150977</guid>
		<description><![CDATA[Dear Jynesh,
      The problem is with the inverted single commas. Replace them by again typing single inverted commas and the script should work fine.

Thanks,]]></description>
		<content:encoded><![CDATA[<p>Dear Jynesh,<br />
      The problem is with the inverted single commas. Replace them by again typing single inverted commas and the script should work fine.</p>
<p>Thanks,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chris</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-128500</link>
		<dc:creator><![CDATA[chris]]></dc:creator>
		<pubDate>Tue, 12 Apr 2011 15:48:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-128500</guid>
		<description><![CDATA[Change this line:

SELECT OBJECT_SCHEMA_NAME([object_id])+&#039;.&#039;+name AS TableName

to:

SELECT OBJECT_SCHEMA_NAME([object_id])+&#039;.[&#039;+name+&#039;]&#039; AS TableName

So you can use the script for tables w/ spaces, etc...

Thanks!]]></description>
		<content:encoded><![CDATA[<p>Change this line:</p>
<p>SELECT OBJECT_SCHEMA_NAME([object_id])+&#8217;.'+name AS TableName</p>
<p>to:</p>
<p>SELECT OBJECT_SCHEMA_NAME([object_id])+&#8217;.['+name+']&#8216; AS TableName</p>
<p>So you can use the script for tables w/ spaces, etc&#8230;</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: CharlesP</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-118028</link>
		<dc:creator><![CDATA[CharlesP]]></dc:creator>
		<pubDate>Fri, 11 Feb 2011 14:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-118028</guid>
		<description><![CDATA[Jynesh, check to make sure your browser did not copy additional characters.  

I am running on SQL 2008 R2 with no problems.  Also there is no asterisk (*) in his code, which is why I believe your copy and paste may be incorrect.]]></description>
		<content:encoded><![CDATA[<p>Jynesh, check to make sure your browser did not copy additional characters.  </p>
<p>I am running on SQL 2008 R2 with no problems.  Also there is no asterisk (*) in his code, which is why I believe your copy and paste may be incorrect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jynesh</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-117823</link>
		<dc:creator><![CDATA[Jynesh]]></dc:creator>
		<pubDate>Thu, 10 Feb 2011 03:33:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-117823</guid>
		<description><![CDATA[Pinal, I exactly copied your code and executed the code but I got the following error. I am using SQL 2008 standard.

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near &#039;*&#039;

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword &#039;FILLFACTOR&#039;.

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near &#039;REBUILD&#039;.

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword &#039;WITH&#039;.

Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword &#039;with&#039;. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.

Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword &#039;Of&#039;. 

I could not figure out by myself. Any advice will be appreciated.

Thanks
Sar]]></description>
		<content:encoded><![CDATA[<p>Pinal, I exactly copied your code and executed the code but I got the following error. I am using SQL 2008 standard.</p>
<p>Msg 102, Level 15, State 1, Line 1<br />
Incorrect syntax near &#8216;*&#8217;</p>
<p>Msg 156, Level 15, State 1, Line 1<br />
Incorrect syntax near the keyword &#8216;FILLFACTOR&#8217;.</p>
<p>Msg 102, Level 15, State 1, Line 1<br />
Incorrect syntax near &#8216;REBUILD&#8217;.</p>
<p>Msg 156, Level 15, State 1, Line 1<br />
Incorrect syntax near the keyword &#8216;WITH&#8217;.</p>
<p>Msg 319, Level 15, State 1, Line 1<br />
Incorrect syntax near the keyword &#8216;with&#8217;. If this statement is a common table expression, an xmlnamespaces clause or a change tracking context clause, the previous statement must be terminated with a semicolon.</p>
<p>Msg 156, Level 15, State 1, Line 1<br />
Incorrect syntax near the keyword &#8216;Of&#8217;. </p>
<p>I could not figure out by myself. Any advice will be appreciated.</p>
<p>Thanks<br />
Sar</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David M</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-114301</link>
		<dc:creator><![CDATA[David M]]></dc:creator>
		<pubDate>Wed, 26 Jan 2011 04:35:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-114301</guid>
		<description><![CDATA[Perhaps I am mistaken, but I was led to believe that rebuilding the Clustered Index of a table automatically led to the rebuilding of any NonClustered indexes within.

That being the case, wouldn&#039;t it be a bad idea to rebuild nonC&#039;s after a Cluster rebuild?]]></description>
		<content:encoded><![CDATA[<p>Perhaps I am mistaken, but I was led to believe that rebuilding the Clustered Index of a table automatically led to the rebuilding of any NonClustered indexes within.</p>
<p>That being the case, wouldn&#8217;t it be a bad idea to rebuild nonC&#8217;s after a Cluster rebuild?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Golova</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-107227</link>
		<dc:creator><![CDATA[Golova]]></dc:creator>
		<pubDate>Tue, 21 Dec 2010 20:28:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-107227</guid>
		<description><![CDATA[Is there a script to keep the current fill factor for SQL2005 and 2008? can you also use 0 as in sql 2000?]]></description>
		<content:encoded><![CDATA[<p>Is there a script to keep the current fill factor for SQL2005 and 2008? can you also use 0 as in sql 2000?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ken Brooks</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-97621</link>
		<dc:creator><![CDATA[Ken Brooks]]></dc:creator>
		<pubDate>Wed, 03 Nov 2010 13:56:46 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-97621</guid>
		<description><![CDATA[OBJECT_SCHEMA_NAME() appears to be a 2008 function and not available in 2005.
Hence the script fails with &#039;OBJECT_SCHEMA_NAME&#039; is not a recognised built-in function name.&#039;]]></description>
		<content:encoded><![CDATA[<p>OBJECT_SCHEMA_NAME() appears to be a 2008 function and not available in 2005.<br />
Hence the script fails with &#8216;OBJECT_SCHEMA_NAME&#8217; is not a recognised built-in function name.&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Khondaker Haque</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-88630</link>
		<dc:creator><![CDATA[Khondaker Haque]]></dc:creator>
		<pubDate>Tue, 21 Sep 2010 01:32:57 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-88630</guid>
		<description><![CDATA[Did you tested your script? or not. Do not submit your script without testing please.]]></description>
		<content:encoded><![CDATA[<p>Did you tested your script? or not. Do not submit your script without testing please.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jernas solomon</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-80086</link>
		<dc:creator><![CDATA[jernas solomon]]></dc:creator>
		<pubDate>Tue, 13 Jul 2010 14:11:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-80086</guid>
		<description><![CDATA[Thanks for u help .. this script very usefule for me..]]></description>
		<content:encoded><![CDATA[<p>Thanks for u help .. this script very usefule for me..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keith Montz</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-56864</link>
		<dc:creator><![CDATA[Keith Montz]]></dc:creator>
		<pubDate>Wed, 21 Oct 2009 15:09:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-56864</guid>
		<description><![CDATA[an improvement on the rebuild script above.

DECLARE @start varchar(20)
DECLARE @startprint varchar(60)
select @start = getdate()
select @startprint = &#039;Started batch at &#039; + @start
print &#039; &#039;
print &#039; &#039;
print @startprint
print &#039; &#039;
print &#039; &#039;
go
-- =========================================== Get list of tables into temp table
Create Table #IndexTable
(
ID int Identity(1,1) not null,
Table_Name varchar(100) not null
)

Insert into #IndexTable
Select name from sys.tables
Where type_desc = &#039;USER_TABLE&#039; AND SUBSTRING([Name], 1, 3)  &#039;tmp&#039;
ORDER BY [Name]
-- =========================================== Declare Variables
Declare @TableName Varchar(100)
Declare @sql Varchar(1000)
Declare @fillfactor int
Declare @Loop int
Declare @cnt int
Declare @Message varchar(100)
-- =========================================== Get Count of tables
Select @cnt = MAX([ID]) from #IndexTable 
SET @Message = convert(varchar(4), @cnt) + &#039; tables found&#039;
PRINT @Message

Set @Loop = 0
set @fillfactor = 80
-- =========================================== Loop thru tables
While (@Loop &lt;= @cnt )
BEGIN
    -- --------------------------------------- Get next table
	Select Top 1 @TableName = Table_Name from #IndexTable
	Where ID not in (Select Top(@Loop)ID from #IndexTable)
	-- --------------------------------------- display status
    SET @Message = &#039;Working on table: &#039; + @TableName + &#039; &#039; + convert(varchar(4), @Loop) + &#039; of &#039; +
           convert(varchar(4), @cnt)
    print @Message
    -- --------------------------------------- Build command and execute it
	Set @sql = &#039;ALTER INDEX ALL ON &#039; + @TableName + &#039; REBUILD WITH (FILLFACTOR = &#039; + CONVERT(VARCHAR(3),@fillfactor) + &#039;)&#039;
	Exec(@sql)
	Set @Loop = @Loop + 1

END
-- =========================================== Drop Temp Table
DROP Table #IndexTable
/* =========================================== Completed */
DECLARE @end varchar(20)
DECLARE @endprint varchar(60)
print &#039; &#039;
print &#039; &#039;
select @end = getdate()
select @endprint = &#039;Ended batch at &#039; + @end
PRINT @endprint
GO]]></description>
		<content:encoded><![CDATA[<p>an improvement on the rebuild script above.</p>
<p>DECLARE @start varchar(20)<br />
DECLARE @startprint varchar(60)<br />
select @start = getdate()<br />
select @startprint = &#8216;Started batch at &#8216; + @start<br />
print &#8216; &#8216;<br />
print &#8216; &#8216;<br />
print @startprint<br />
print &#8216; &#8216;<br />
print &#8216; &#8216;<br />
go<br />
&#8211; =========================================== Get list of tables into temp table<br />
Create Table #IndexTable<br />
(<br />
ID int Identity(1,1) not null,<br />
Table_Name varchar(100) not null<br />
)</p>
<p>Insert into #IndexTable<br />
Select name from sys.tables<br />
Where type_desc = &#8216;USER_TABLE&#8217; AND SUBSTRING([Name], 1, 3)  &#8216;tmp&#8217;<br />
ORDER BY [Name]<br />
&#8211; =========================================== Declare Variables<br />
Declare @TableName Varchar(100)<br />
Declare @sql Varchar(1000)<br />
Declare @fillfactor int<br />
Declare @Loop int<br />
Declare @cnt int<br />
Declare @Message varchar(100)<br />
&#8211; =========================================== Get Count of tables<br />
Select @cnt = MAX([ID]) from #IndexTable<br />
SET @Message = convert(varchar(4), @cnt) + &#8216; tables found&#8217;<br />
PRINT @Message</p>
<p>Set @Loop = 0<br />
set @fillfactor = 80<br />
&#8211; =========================================== Loop thru tables<br />
While (@Loop &lt;= @cnt )<br />
BEGIN<br />
    &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Get next table<br />
	Select Top 1 @TableName = Table_Name from #IndexTable<br />
	Where ID not in (Select Top(@Loop)ID from #IndexTable)<br />
	&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; display status<br />
    SET @Message = &#039;Working on table: &#039; + @TableName + &#039; &#039; + convert(varchar(4), @Loop) + &#039; of &#039; +<br />
           convert(varchar(4), @cnt)<br />
    print @Message<br />
    &#8212; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212; Build command and execute it<br />
	Set @sql = &#039;ALTER INDEX ALL ON &#039; + @TableName + &#039; REBUILD WITH (FILLFACTOR = &#039; + CONVERT(VARCHAR(3),@fillfactor) + &#039;)&#039;<br />
	Exec(@sql)<br />
	Set @Loop = @Loop + 1</p>
<p>END<br />
&#8211; =========================================== Drop Temp Table<br />
DROP Table #IndexTable<br />
/* =========================================== Completed */<br />
DECLARE @end varchar(20)<br />
DECLARE @endprint varchar(60)<br />
print &#039; &#039;<br />
print &#039; &#039;<br />
select @end = getdate()<br />
select @endprint = &#039;Ended batch at &#039; + @end<br />
PRINT @endprint<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brandon Reno</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-52550</link>
		<dc:creator><![CDATA[Brandon Reno]]></dc:creator>
		<pubDate>Fri, 29 May 2009 21:27:29 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-52550</guid>
		<description><![CDATA[sp_msforeachtable &#039;ALTER INDEX ALL ON ? REBUILD WITH (FILLFACTOR = 80)’]]></description>
		<content:encoded><![CDATA[<p>sp_msforeachtable &#8216;ALTER INDEX ALL ON ? REBUILD WITH (FILLFACTOR = 80)’</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Virgilio</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-51570</link>
		<dc:creator><![CDATA[Virgilio]]></dc:creator>
		<pubDate>Tue, 05 May 2009 18:07:01 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-51570</guid>
		<description><![CDATA[Cursors are helpful when you don;t Know SQL ;)

Create Table #IndexTable
(
ID int Identity(1,1) not null,
Table_Name varchar(100) not null
)

Insert into #IndexTable
Select name from sys.tables
Where type_desc = &#039;USER_TABLE&#039;

Declare @TableName Varchar(100)
Declare @sql Varchar(1000)
Declare @fillfactor int
Declare @Loop int
Declare @cnt int
Select @cnt = COUNT(*) from #IndexTable
Set @Loop = 0
set @fillfactor = 80
While (@Loop &lt; @cnt )
BEGIN
   Select  Top 1 @TableName = Table_Name from #IndexTable
   Where ID not in (Select Top(@Loop)ID from #IndexTable)
   
    Set @sql = &#039;ALTER INDEX ALL ON &#039; + @TableName + &#039; REBUILD WITH (FILLFACTOR = &#039; + CONVERT(VARCHAR(3),@fillfactor) + &#039;)&#039;
	Exec(@sql)
	Set  @Loop += 1
   
END



DROP Table #IndexTable]]></description>
		<content:encoded><![CDATA[<p>Cursors are helpful when you don;t Know SQL ;)</p>
<p>Create Table #IndexTable<br />
(<br />
ID int Identity(1,1) not null,<br />
Table_Name varchar(100) not null<br />
)</p>
<p>Insert into #IndexTable<br />
Select name from sys.tables<br />
Where type_desc = &#8216;USER_TABLE&#8217;</p>
<p>Declare @TableName Varchar(100)<br />
Declare @sql Varchar(1000)<br />
Declare @fillfactor int<br />
Declare @Loop int<br />
Declare @cnt int<br />
Select @cnt = COUNT(*) from #IndexTable<br />
Set @Loop = 0<br />
set @fillfactor = 80<br />
While (@Loop &lt; @cnt )<br />
BEGIN<br />
   Select  Top 1 @TableName = Table_Name from #IndexTable<br />
   Where ID not in (Select Top(@Loop)ID from #IndexTable)</p>
<p>    Set @sql = &#8216;ALTER INDEX ALL ON &#8216; + @TableName + &#8216; REBUILD WITH (FILLFACTOR = &#8216; + CONVERT(VARCHAR(3),@fillfactor) + &#8216;)&#8217;<br />
	Exec(@sql)<br />
	Set  @Loop += 1</p>
<p>END</p>
<p>DROP Table #IndexTable</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - FIX : ERROR : Msg 5834, Level 16, State 1, Line 1 The affinity mask specified conflicts with the IO affinity mask specified. Use the override option to force this configuration Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-46173</link>
		<dc:creator><![CDATA[SQL SERVER - FIX : ERROR : Msg 5834, Level 16, State 1, Line 1 The affinity mask specified conflicts with the IO affinity mask specified. Use the override option to force this configuration Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sat, 31 Jan 2009 01:30:32 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-46173</guid>
		<description><![CDATA[[...] January 31, 2009 by pinaldave    Yesterday I came across following error while enabling fill factor for my database server, when I was trying to write article SQL SERVER - 2008 - 2005 - Rebuild Every Index of All Tables of Database - Rebuild Index with FillFa.... [...]]]></description>
		<content:encoded><![CDATA[<p>[...] January 31, 2009 by pinaldave    Yesterday I came across following error while enabling fill factor for my database server, when I was trying to write article SQL SERVER &#8211; 2008 &#8211; 2005 &#8211; Rebuild Every Index of All Tables of Database &#8211; Rebuild Index with FillFa&#8230;. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Darth Sonic</title>
		<link>http://blog.sqlauthority.com/2009/01/30/sql-server-2008-2005-rebuild-every-index-of-all-tables-of-database-rebuild-index-with-fillfactor/#comment-46163</link>
		<dc:creator><![CDATA[Darth Sonic]]></dc:creator>
		<pubDate>Fri, 30 Jan 2009 08:27:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=2210#comment-46163</guid>
		<description><![CDATA[A similar script by me for SQL Server 2000 which keeps current fillfactors:

DECLARE @TableName varchar(255)

DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
WHERE table_type = &#039;base table&#039;

OPEN TableCursor

FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
  DBCC DBREINDEX (@TableName,&#039; &#039;,0)
  FETCH NEXT FROM TableCursor INTO @TableName
END

CLOSE TableCursor

DEALLOCATE TableCursor
GO]]></description>
		<content:encoded><![CDATA[<p>A similar script by me for SQL Server 2000 which keeps current fillfactors:</p>
<p>DECLARE @TableName varchar(255)</p>
<p>DECLARE TableCursor CURSOR FOR<br />
SELECT table_name FROM information_schema.tables<br />
WHERE table_type = &#8216;base table&#8217;</p>
<p>OPEN TableCursor</p>
<p>FETCH NEXT FROM TableCursor INTO @TableName<br />
WHILE @@FETCH_STATUS = 0<br />
BEGIN<br />
  DBCC DBREINDEX (@TableName,&#8217; &#8216;,0)<br />
  FETCH NEXT FROM TableCursor INTO @TableName<br />
END</p>
<p>CLOSE TableCursor</p>
<p>DEALLOCATE TableCursor<br />
GO</p>
]]></content:encoded>
	</item>
</channel>
</rss>

