﻿<?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 / Article Discussions by Author / Discuss content posted by Jon Morisi  / Index Fragmentation for All Databases / 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 11:00:25 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Hi Jon,Still getting this...Msg 102, Level 15, State 1, Line 14Incorrect syntax near '('.(0 row(s) affected)(0 row(s) affected)can you please copy and paste your script in the Article you posted, and run it in sql 2008? I hope you will get the same error as I got.Thanks.</description><pubDate>Wed, 31 Mar 2010 17:27:27 GMT</pubDate><dc:creator>vic610</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>100 should work just fine, it's really SQL 2000 (80) that's the issue.I use the script all the time on SQL 2005, SQL 2008 servers.  If even 1 db is in mode 80 that's the error your typically get.</description><pubDate>Wed, 31 Mar 2010 09:40:42 GMT</pubDate><dc:creator>Jon.Morisi</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>100</description><pubDate>Wed, 31 Mar 2010 09:37:45 GMT</pubDate><dc:creator>vic610</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>The script is written such that the compatibility level all databases must be 90. To check runselect compatibility_level from sys.databases</description><pubDate>Tue, 30 Mar 2010 16:37:29 GMT</pubDate><dc:creator>Jon.Morisi</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Hi,I am getting syntax error. please see below...Msg 102, Level 15, State 1, Line 14Incorrect syntax near '('.Msg 102, Level 15, State 1, Line 14Incorrect syntax near '('.Msg 102, Level 15, State 1, Line 14Incorrect syntax near '('.Msg 102, Level 15, State 1, Line 14Incorrect syntax near '('.</description><pubDate>Tue, 30 Mar 2010 07:17:05 GMT</pubDate><dc:creator>vic610</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Here you go: [url=http://www.sqlskills.com/BLOGS/PAUL/post/Misconceptions-about-running-DMVs-on-database-with-lower-compatibility-levels.aspx]Misconceptions about running DMVs on database with lower compatibility levels[/url]</description><pubDate>Tue, 16 Jun 2009 13:42:22 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>ok - will do. It's lunchtime - nothing else to do :-)</description><pubDate>Tue, 16 Jun 2009 13:24:41 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Now that is interesting, didn't know what. Worth of a blog post.</description><pubDate>Tue, 16 Jun 2009 12:31:42 GMT</pubDate><dc:creator>Steve Jones - SSC Editor</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>You don't need to use DBCC SHOWCONTIG for databases in non-90 compat modes. As long you run the DMV script in a database that's in 90-compat mode, it'll work fine against databases that aren't. Common misconception.</description><pubDate>Tue, 16 Jun 2009 11:15:31 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>This is pseudocode, but you could do something like this...if sp_MSForEachDB works in mode 65[code]BEGINCREATE TABLE #INDEXFRAGINFO--Create table structure based on result fieldsDECLARE @command VARCHAR(128) SELECT @command = 'Use [' + '?' + '] dbcc showcontig WITH ALL_INDEXES, TABLERESULTS, FAST'INSERT #INDEXFRAGINFO EXEC sp_MSForEachDB @commandSELECT * FROM #INDEXFRAGINFODROP TABLE #INDEXFRAGINFOENDGO[/code]</description><pubDate>Tue, 16 Jun 2009 11:03:35 GMT</pubDate><dc:creator>Jon.Morisi</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>It would be great to have a version of this that works at compatibility level 65.</description><pubDate>Tue, 16 Jun 2009 10:19:13 GMT</pubDate><dc:creator>kevin-1084732</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Be careful running a script like this that touches all indexes on all databases. Even though the LIMITED mode is only oging to read the level of the index above the leaf-level to get the logical fragmentation (I wrote the code inside SQL Server), running it over all indexes on all databases may do the equivalent of flushing out your buffer pool.A much better approach once you've got some knowledge of which indexes are your problem-children is to have a table with those indexes in and only check fragmentation on them - rather than everything in all databases. This does much less, and more targeted reads.If you don't have a clue about what the problem is though, this script is great.Thanks</description><pubDate>Tue, 16 Jun 2009 08:18:24 GMT</pubDate><dc:creator>Paul Randal</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>the compatibility level all databases must be 90</description><pubDate>Tue, 16 Jun 2009 08:11:32 GMT</pubDate><dc:creator>Jon.Morisi</dc:creator></item><item><title>RE: Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>I had a syntax error.  Is it just me???</description><pubDate>Tue, 16 Jun 2009 07:27:36 GMT</pubDate><dc:creator>Mark Thabet-457565</dc:creator></item><item><title>Index Fragmentation for All Databases</title><link>http://www.sqlservercentral.com/Forums/Topic731628-1563-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/67088/"&gt;Index Fragmentation for All Databases&lt;/A&gt;[/B]</description><pubDate>Tue, 09 Jun 2009 10:25:28 GMT</pubDate><dc:creator>Jon.Morisi</dc:creator></item></channel></rss>