<?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/"
		>
<channel>
	<title>Comments on: MS SQL 2005 (T-SQL) Row Count for Each Table</title>
	<atom:link href="http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/</link>
	<description>Web Designer &#38; Software Engineer</description>
	<lastBuildDate>Tue, 15 May 2012 02:22:31 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: SamT</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-49502</link>
		<dc:creator>SamT</dc:creator>
		<pubDate>Tue, 24 Jan 2012 21:06:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-49502</guid>
		<description>-- I used this:

select o.name, i.rows, i.indid --, i.*
from sysindexes i, sysobjects o
where i.indid &lt; 2
and o.id = i.id
and o.type = &#039;u&#039;
order by 1</description>
		<content:encoded><![CDATA[<p>&#8211; I used this:</p>
<p>select o.name, i.rows, i.indid &#8211;, i.*<br />
from sysindexes i, sysobjects o<br />
where i.indid &lt; 2<br />
and o.id = i.id<br />
and o.type = &#039;u&#039;<br />
order by 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: anon</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-48868</link>
		<dc:creator>anon</dc:creator>
		<pubDate>Fri, 18 Nov 2011 16:38:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-48868</guid>
		<description>exec sp_msforeachtable &quot;select &#039;?&#039; tablename, sum(1) totalrows from ?&quot;</description>
		<content:encoded><![CDATA[<p>exec sp_msforeachtable &#8220;select &#8216;?&#8217; tablename, sum(1) totalrows from ?&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ram</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-48526</link>
		<dc:creator>Ram</dc:creator>
		<pubDate>Fri, 08 Apr 2011 20:19:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-48526</guid>
		<description>Jus another way... 

CREATE TABLE DB_TAB (TABLE_QUALIFIER VARCHAR(50),TABLE_OWNER VARCHAR(50), TABLE_NAME VARCHAR(100), TABLE_TYPE VARCHAR(50), REMARKS VARCHAR(50))

CREATE TABLE DB_TBL_ROWCNT (T_NAME VARCHAR(100), R_COUNT INTEGER)

insert into db_tab exec sp_tables  

select &#039;select &#039;&#039;&#039;+ table_name +&#039;&#039;&#039; ,count(*) from &#039;+ table_name + &#039; union&#039; 
from db_tab where table_type=&#039;TABLE&#039;
--(output of above query ) --&gt; [A]

INSERT INTO DB_TBL_ROWCNT
--&gt;[A] (remove the last &quot;union&quot; here)

select * from DB_TBL_ROWCNT 


Thnx,
Ram</description>
		<content:encoded><![CDATA[<p>Jus another way&#8230; </p>
<p>CREATE TABLE DB_TAB (TABLE_QUALIFIER VARCHAR(50),TABLE_OWNER VARCHAR(50), TABLE_NAME VARCHAR(100), TABLE_TYPE VARCHAR(50), REMARKS VARCHAR(50))</p>
<p>CREATE TABLE DB_TBL_ROWCNT (T_NAME VARCHAR(100), R_COUNT INTEGER)</p>
<p>insert into db_tab exec sp_tables  </p>
<p>select &#8216;select &#8221;&#8217;+ table_name +&#8221;&#8217; ,count(*) from &#8216;+ table_name + &#8216; union&#8217;<br />
from db_tab where table_type=&#8217;TABLE&#8217;<br />
&#8211;(output of above query ) &#8211;&gt; [A]</p>
<p>INSERT INTO DB_TBL_ROWCNT<br />
&#8211;&gt;[A] (remove the last &#8220;union&#8221; here)</p>
<p>select * from DB_TBL_ROWCNT </p>
<p>Thnx,<br />
Ram</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ram</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-48525</link>
		<dc:creator>Ram</dc:creator>
		<pubDate>Fri, 08 Apr 2011 20:15:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-48525</guid>
		<description>CREATE TABLE DB_TBL_ROWCNT (T_NAME VARCHAR(100), R_COUNT INTEGER)

insert into db_tab exec sp_tables  

select &#039;select &#039;&#039;&#039;+ table_name +&#039;&#039;&#039; ,count(*) from &#039;+ table_name + &#039; union&#039; 
from db_tab where table_type=&#039;TABLE&#039;
--(output of above query ) --&gt; [A]

INSERT INTO DB_TBL_ROWCNT
--&gt;[A]

select * from DB_TBL_ROWCNT</description>
		<content:encoded><![CDATA[<p>CREATE TABLE DB_TBL_ROWCNT (T_NAME VARCHAR(100), R_COUNT INTEGER)</p>
<p>insert into db_tab exec sp_tables  </p>
<p>select &#8216;select &#8221;&#8217;+ table_name +&#8221;&#8217; ,count(*) from &#8216;+ table_name + &#8216; union&#8217;<br />
from db_tab where table_type=&#8217;TABLE&#8217;<br />
&#8211;(output of above query ) &#8211;&gt; [A]</p>
<p>INSERT INTO DB_TBL_ROWCNT<br />
&#8211;&gt;[A]</p>
<p>select * from DB_TBL_ROWCNT</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: cmcma</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-44631</link>
		<dc:creator>cmcma</dc:creator>
		<pubDate>Wed, 15 Sep 2010 16:44:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-44631</guid>
		<description>Hi Justin Carmony,

I am an Oracle DBA and I wanted something in SQL Server 2005 that is similar to 
  PROCEDURE GET_STAGING_INSERT_COUNTS
  IS
   v_ErrorCode integer;
   v_ErrorMessage varchar2(512);
   v_table_name   varchar2(100);
   e_countfailure EXCEPTION;
  BEGIN
     .
     .
     .    
       for c1rec0 in (select  table_name,
                        to_number(extractvalue(xmltype(dbms_xmlgen.getxml(&#039;select count(*) c from &#039; &#124;&#124;
                                                     table_name)),
                                                     &#039;/ROWSET/ROW/C&#039;)) ROW_count
                         from user_tables ttl
                         ) loop
           begin

                insert_log_data(c1rec0.table_name,
                                         to_char(sysdate,   &#039;YYYYMMDDHH24MISS&#039;),
                                         &#039;STG COUNT&#039;,   &#039;Success&#039;,   c1rec0.ROW_count,
                                         &#039;from staging&#039;);
                COMMIT;
           end;
     .
     .
     .

            end loop;
     .
     .
     .
        COMMIT;
       EXCEPTION
    WHEN others THEN
      return_status := &#039;Failed&#039;;
      v_errorcode := SQLCODE;
      v_errormessage := sqlerrm;
      insert_ATOS_log_data(v_table_name,   to_char(sysdate,   &#039;YYYYMMDDHH24MISS&#039;),   &#039;COUNTS&#039;,   &#039;Failed&#039;,   0,   &#039;GET_STAGING_INSERT_COUNTS&#039;);
      insert_ATOS_log_data(&#039;Process Failed&#039;,   to_char(sysdate,   &#039;YYYYMMDDHH24MISS&#039;),   &#039;COUNTS&#039;,   &#039;Failed&#039;,   0,   &#039;Load_Control Error Code: &#039; &#124;&#124; v_errorcode &#124;&#124; &#039; Error Message: &#039; &#124;&#124; v_errormessage);
  END GET_STAGING_INSERT_COUNTS;

and the above will save me a tremendous amount of time.
Thank You</description>
		<content:encoded><![CDATA[<p>Hi Justin Carmony,</p>
<p>I am an Oracle DBA and I wanted something in SQL Server 2005 that is similar to<br />
  PROCEDURE GET_STAGING_INSERT_COUNTS<br />
  IS<br />
   v_ErrorCode integer;<br />
   v_ErrorMessage varchar2(512);<br />
   v_table_name   varchar2(100);<br />
   e_countfailure EXCEPTION;<br />
  BEGIN<br />
     .<br />
     .<br />
     .<br />
       for c1rec0 in (select  table_name,<br />
                        to_number(extractvalue(xmltype(dbms_xmlgen.getxml(&#8216;select count(*) c from &#8216; ||<br />
                                                     table_name)),<br />
                                                     &#8216;/ROWSET/ROW/C&#8217;)) ROW_count<br />
                         from user_tables ttl<br />
                         ) loop<br />
           begin</p>
<p>                insert_log_data(c1rec0.table_name,<br />
                                         to_char(sysdate,   &#8216;YYYYMMDDHH24MISS&#8217;),<br />
                                         &#8216;STG COUNT&#8217;,   &#8216;Success&#8217;,   c1rec0.ROW_count,<br />
                                         &#8216;from staging&#8217;);<br />
                COMMIT;<br />
           end;<br />
     .<br />
     .<br />
     .</p>
<p>            end loop;<br />
     .<br />
     .<br />
     .<br />
        COMMIT;<br />
       EXCEPTION<br />
    WHEN others THEN<br />
      return_status := &#8216;Failed&#8217;;<br />
      v_errorcode := SQLCODE;<br />
      v_errormessage := sqlerrm;<br />
      insert_ATOS_log_data(v_table_name,   to_char(sysdate,   &#8216;YYYYMMDDHH24MISS&#8217;),   &#8216;COUNTS&#8217;,   &#8216;Failed&#8217;,   0,   &#8216;GET_STAGING_INSERT_COUNTS&#8217;);<br />
      insert_ATOS_log_data(&#8216;Process Failed&#8217;,   to_char(sysdate,   &#8216;YYYYMMDDHH24MISS&#8217;),   &#8216;COUNTS&#8217;,   &#8216;Failed&#8217;,   0,   &#8216;Load_Control Error Code: &#8216; || v_errorcode || &#8216; Error Message: &#8216; || v_errormessage);<br />
  END GET_STAGING_INSERT_COUNTS;</p>
<p>and the above will save me a tremendous amount of time.<br />
Thank You</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nausea</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-21728</link>
		<dc:creator>nausea</dc:creator>
		<pubDate>Tue, 02 Jun 2009 08:44:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-21728</guid>
		<description>I used this:

SELECT object_name(id) ,rowcnt
FROM sysindexes
WHERE indid IN (1,0) AND OBJECTPROPERTY(id, &#039;IsUserTable&#039;) = 1
order by rowcnt desc</description>
		<content:encoded><![CDATA[<p>I used this:</p>
<p>SELECT object_name(id) ,rowcnt<br />
FROM sysindexes<br />
WHERE indid IN (1,0) AND OBJECTPROPERTY(id, &#8216;IsUserTable&#8217;) = 1<br />
order by rowcnt desc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-12233</link>
		<dc:creator>Peter</dc:creator>
		<pubDate>Fri, 06 Feb 2009 19:20:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-12233</guid>
		<description>Nice little post for this.  I tweaked it for SQl Server 2000 and its limitation on varchar size.  Left the cursor use in:

-- Create a cursor to loop through the System Ojects and get each table name
DECLARE TBL_CURSOR CURSOR
-- Declare the SQL Statement to cursor through
FOR (SELECT Name FROM Sysobjects WHERE Type=&#039;U&#039;)
 
-- Declare the @SQL Variable which will hold our dynamic sql
DECLARE @SQL VARCHAR(8000), @SQL2 VARCHAR(8000), @SQL3 VARCHAR(8000)
SET @SQL = &#039;&#039;;
SET @SQL2 = &#039;&#039;;
SET @SQL3 = &#039;&#039;;
-- Declare the @TblName Variable which will hold the name of the current table
DECLARE @TblName VARCHAR(255);
 
-- Open the Cursor
OPEN TBL_CURSOR
 
-- Setup the Fetch While that will loop through our cursor and set @TblName
FETCH NEXT FROM TBL_CURSOR INTO @TblName
-- Do this while we are not at the end of the record set
WHILE (@@FETCH_STATUS  -1)
BEGIN
-- Appeand this table&#039;s select count statement to our sql variable
IF ASCII (@TblName) % 3 = 0
  SET @SQL = @SQL + &#039; ( SELECT &#039;&#039;&#039;+@TblName+&#039;&#039;&#039; AS Table_Name, COUNT(*) AS Count FROM &#039;+@TblName+&#039; ) UNION&#039;;
 
IF ASCII (@TblName) % 3 = 1
  SET @SQL2 = @SQL2 + &#039; ( SELECT &#039;&#039;&#039;+@TblName+&#039;&#039;&#039; AS Table_Name, COUNT(*) AS Count FROM &#039;+@TblName+&#039; ) UNION&#039;;
 
IF ASCII (@TblName) % 3 = 2
  SET @SQL3 = @SQL3 + &#039; ( SELECT &#039;&#039;&#039;+@TblName+&#039;&#039;&#039; AS Table_Name, COUNT(*) AS Count FROM &#039;+@TblName+&#039; ) UNION&#039;;
 
-- Pull the next record
FETCH NEXT FROM TBL_CURSOR INTO @TblName
-- End the Cursor Loop
END
 
-- Close and Clean Up the Cursor
CLOSE TBL_CURSOR
DEALLOCATE TBL_CURSOR
 
-- Since we were adding the UNION at the end of each part, the last query will have
-- an extra UNION. Lets  trim it off.
--SET @SQL = LEFT(@SQL, LEN(@SQL)-6);
--SET @SQL2 = LEFT(@SQL2, LEN(@SQL2)-6);
SET @SQL3 = LEFT(@SQL3, LEN(@SQL3)-6);
 
-- Lets do an Order By. You can pick between Count and Table Name by picking which
-- line to execute below.
--SET @SQL = @SQL + &#039; ORDER BY Count&#039;;
--SET @SQL = @SQL + &#039; ORDER BY Table_Name&#039;;
 
-- Now that our Dynamic SQL statement is ready, lets execute it.
EXEC (@SQL + @SQL2 + @SQL3 + &#039; ORDER BY Count&#039;);
--EXEC (@SQL + @SQL2 + @SQL3 + &#039; ORDER BY Table_Name&#039;);
GO</description>
		<content:encoded><![CDATA[<p>Nice little post for this.  I tweaked it for SQl Server 2000 and its limitation on varchar size.  Left the cursor use in:</p>
<p>&#8211; Create a cursor to loop through the System Ojects and get each table name<br />
DECLARE TBL_CURSOR CURSOR<br />
&#8211; Declare the SQL Statement to cursor through<br />
FOR (SELECT Name FROM Sysobjects WHERE Type=&#8217;U')</p>
<p>&#8211; Declare the @SQL Variable which will hold our dynamic sql<br />
DECLARE @SQL VARCHAR(8000), @SQL2 VARCHAR(8000), @SQL3 VARCHAR(8000)<br />
SET @SQL = &#8221;;<br />
SET @SQL2 = &#8221;;<br />
SET @SQL3 = &#8221;;<br />
&#8211; Declare the @TblName Variable which will hold the name of the current table<br />
DECLARE @TblName VARCHAR(255);</p>
<p>&#8211; Open the Cursor<br />
OPEN TBL_CURSOR</p>
<p>&#8211; Setup the Fetch While that will loop through our cursor and set @TblName<br />
FETCH NEXT FROM TBL_CURSOR INTO @TblName<br />
&#8211; Do this while we are not at the end of the record set<br />
WHILE (@@FETCH_STATUS  -1)<br />
BEGIN<br />
&#8211; Appeand this table&#8217;s select count statement to our sql variable<br />
IF ASCII (@TblName) % 3 = 0<br />
  SET @SQL = @SQL + &#8216; ( SELECT &#8221;&#8217;+@TblName+&#8221;&#8217; AS Table_Name, COUNT(*) AS Count FROM &#8216;+@TblName+&#8217; ) UNION&#8217;;</p>
<p>IF ASCII (@TblName) % 3 = 1<br />
  SET @SQL2 = @SQL2 + &#8216; ( SELECT &#8221;&#8217;+@TblName+&#8221;&#8217; AS Table_Name, COUNT(*) AS Count FROM &#8216;+@TblName+&#8217; ) UNION&#8217;;</p>
<p>IF ASCII (@TblName) % 3 = 2<br />
  SET @SQL3 = @SQL3 + &#8216; ( SELECT &#8221;&#8217;+@TblName+&#8221;&#8217; AS Table_Name, COUNT(*) AS Count FROM &#8216;+@TblName+&#8217; ) UNION&#8217;;</p>
<p>&#8211; Pull the next record<br />
FETCH NEXT FROM TBL_CURSOR INTO @TblName<br />
&#8211; End the Cursor Loop<br />
END</p>
<p>&#8211; Close and Clean Up the Cursor<br />
CLOSE TBL_CURSOR<br />
DEALLOCATE TBL_CURSOR</p>
<p>&#8211; Since we were adding the UNION at the end of each part, the last query will have<br />
&#8211; an extra UNION. Lets  trim it off.<br />
&#8211;SET @SQL = LEFT(@SQL, LEN(@SQL)-6);<br />
&#8211;SET @SQL2 = LEFT(@SQL2, LEN(@SQL2)-6);<br />
SET @SQL3 = LEFT(@SQL3, LEN(@SQL3)-6);</p>
<p>&#8211; Lets do an Order By. You can pick between Count and Table Name by picking which<br />
&#8211; line to execute below.<br />
&#8211;SET @SQL = @SQL + &#8216; ORDER BY Count&#8217;;<br />
&#8211;SET @SQL = @SQL + &#8216; ORDER BY Table_Name&#8217;;</p>
<p>&#8211; Now that our Dynamic SQL statement is ready, lets execute it.<br />
EXEC (@SQL + @SQL2 + @SQL3 + &#8216; ORDER BY Count&#8217;);<br />
&#8211;EXEC (@SQL + @SQL2 + @SQL3 + &#8216; ORDER BY Table_Name&#8217;);<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Colin</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-11235</link>
		<dc:creator>Colin</dc:creator>
		<pubDate>Thu, 15 Jan 2009 07:44:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-11235</guid>
		<description>Great post. Only issue I had was that my tables all use different schemas and not the default &quot;dbo&quot; schema, so I had to join to the sys.schemas table on schema_id and then concatenate the two columns from the sys.objects and sys.schemas tables together to get it to work.

Quick question: Is there a way to list the row counts as well as the table sizes?</description>
		<content:encoded><![CDATA[<p>Great post. Only issue I had was that my tables all use different schemas and not the default &#8220;dbo&#8221; schema, so I had to join to the sys.schemas table on schema_id and then concatenate the two columns from the sys.objects and sys.schemas tables together to get it to work.</p>
<p>Quick question: Is there a way to list the row counts as well as the table sizes?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neal</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-9598</link>
		<dc:creator>Neal</dc:creator>
		<pubDate>Thu, 11 Dec 2008 18:04:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-9598</guid>
		<description>Wouldn&#039;t this be easier?!

SELECT &#039;select &#039;&#039;&#039;+ name + &#039;&#039;&#039;, count(*) from &#039; +  name + &#039; union&#039; 
FROM Sysobjects 
WHERE Type=&#039;U&#039; 
ORDER BY 1;

Copy + paste the results, remove the trailing &#039;union&#039; and add your &#039;order by&#039; clause.</description>
		<content:encoded><![CDATA[<p>Wouldn&#8217;t this be easier?!</p>
<p>SELECT &#8216;select &#8221;&#8217;+ name + &#8221;&#8217;, count(*) from &#8216; +  name + &#8216; union&#8217;<br />
FROM Sysobjects<br />
WHERE Type=&#8217;U&#8217;<br />
ORDER BY 1;</p>
<p>Copy + paste the results, remove the trailing &#8216;union&#8217; and add your &#8216;order by&#8217; clause.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dos</title>
		<link>http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/comment-page-1/#comment-8791</link>
		<dc:creator>Dos</dc:creator>
		<pubDate>Thu, 06 Nov 2008 14:30:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.justincarmony.com/blog/2008/02/19/ms-sql-2005-t-sql-row-count-for-each-table/#comment-8791</guid>
		<description>The sysindexes query is fine but relies upon your database stats being up-to-date.

Also I found that square brackets were needed around the tablename on line 26 - in the dynamic query (some of my tables begin with a numeric character)

instead of:
SET @SQL = @SQL + &#039; ( SELECT &#039;&#039;&#039;+@TblName+&#039;&#039;&#039; AS Table_Name,COUNT(*) AS Count FROM &#039;+@TblName+&#039; ) UNION&#039;

use:
SET @SQL = @SQL + &#039; ( SELECT &#039;&#039;&#039;+@TblName+&#039;&#039;&#039; AS Table_Name,COUNT(*) AS Count FROM [&#039;+@TblName+&#039;] ) UNION&#039;</description>
		<content:encoded><![CDATA[<p>The sysindexes query is fine but relies upon your database stats being up-to-date.</p>
<p>Also I found that square brackets were needed around the tablename on line 26 &#8211; in the dynamic query (some of my tables begin with a numeric character)</p>
<p>instead of:<br />
SET @SQL = @SQL + &#8216; ( SELECT &#8221;&#8217;+@TblName+&#8221;&#8217; AS Table_Name,COUNT(*) AS Count FROM &#8216;+@TblName+&#8217; ) UNION&#8217;</p>
<p>use:<br />
SET @SQL = @SQL + &#8216; ( SELECT &#8221;&#8217;+@TblName+&#8221;&#8217; AS Table_Name,COUNT(*) AS Count FROM ['+@TblName+'] ) UNION&#8217;</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 15/26 queries in 0.009 seconds using memcached
Content Delivery Network via Rackspace Cloud Files: c747925.r25.cf2.rackcdn.com

Served from: www.justincarmony.com @ 2012-05-17 21:43:53 -->
