<?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; Query to find number Rows, Columns, ByteSize for each table in the current database &#8211; Find Biggest Table in Database</title>
	<atom:link href="http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/</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: Akshay</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-244515</link>
		<dc:creator><![CDATA[Akshay]]></dc:creator>
		<pubDate>Fri, 27 Jan 2012 12:10:21 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-244515</guid>
		<description><![CDATA[Query to find table size for all tables of each database in a server:

DECLARE @DatabaseName VARCHAR(100)   
DECLARE @SQL VARCHAR(max)

--Main table to keep all data
CREATE TABLE #TempTableMain
(
	databaseName varchar(100),
    tableName varchar(100),
    numberofRows varchar(100),
    reservedSize varchar(50),
    dataSize varchar(50),
    indexSize varchar(50),
    unusedSize varchar(50)
)

--table to keep data per database and then truncate for the next database
CREATE TABLE #TempTable
(
    tableName varchar(100),
    numberofRows varchar(100),
    reservedSize varchar(50),
    dataSize varchar(50),
    indexSize varchar(50),
    unusedSize varchar(50)
)

--table to store tablenames in a particular database
create table #tableName (name varchar(100))

--Cursor for running query per database
DECLARE databaseCursor CURSOR
FOR select [name] from msdb.sys.databases
where [name] not in (&#039;master&#039;,&#039;tempdb&#039;,&#039;model&#039;,&#039;msdb&#039;)


OPEN databaseCursor
FETCH NEXT FROM databaseCursor INTO @DatabaseName
WHILE (@@Fetch_Status &gt;= 0)
BEGIN
			--storing tableNames of a particuler database in a temp table
			SELECT @SQL = &#039;use &#039;+@DatabaseName+&#039;
			insert into #tableName
			select [name] from sys.tables&#039;
			exec(@SQL)
					
			--soring table information in temp table
			SELECT @SQL = 
			COALESCE(@SQL + CHAR(13) + &#039; &#039; ,&#039;&#039;) +
			&#039;
			use &#039;+  @DatabaseName+&#039; 
			INSERT  #TempTable
				EXEC sp_spaceused &#039;+name
				from #tableName
		        print @SQL
		        exec (@SQL)
		    
		    --storing data for the current database in the main table
			INSERT #TempTableMain
			select @DatabaseName,* from #TempTable
		    
		    --truncating temp tables for next run
		    truncate table #tableName
			truncate table #TempTable

FETCH NEXT FROM databaseCursor INTO @DatabaseName
END
CLOSE databaseCursor
DEALLOCATE databaseCursor

--tables to get size in MB and GB
--this part is optional and configurable as per user and usage
CREATE TABLE #TempTableMainMB
(
	databaseName varchar(100),
    tableName varchar(100),
    numberofRows varchar(100),
    reservedSizeMB varchar(50),
    dataSizeMB varchar(50),
    indexSizeMB varchar(50),
    unusedSizeMB varchar(50)
)

CREATE TABLE #TempTableMainGB
(
	databaseName varchar(100),
    tableName varchar(100),
    numberofRows varchar(100),
    reservedSizeGB varchar(50),
    dataSizeGB varchar(50),
    indexSizeGB varchar(50),
    unusedSizeGB varchar(50)
)

insert #TempTableMainMB
select * from #TempTableMain

--Remove &#039;KB&#039; from tables
update #TempTableMainMB
set reservedSizeMB=REPLACE(reservedSizeMB,&#039; KB&#039;,&#039;&#039;),
	dataSizeMB=REPLACE(dataSizeMB,&#039; KB&#039;,&#039;&#039;),
	indexSizeMB=REPLACE(indexSizeMB,&#039; KB&#039;,&#039;&#039;),
	unusedSizeMB=REPLACE(unusedSizeMB,&#039; KB&#039;,&#039;&#039;)

update #TempTableMainMB
set reservedSizeMB=cast(CAST(reservedSizeMB as INT)/1024 AS varchar(100)),
	dataSizeMB=cast(CAST(dataSizeMB as INT)/1024 AS varchar(100)),
	indexSizeMB=cast(CAST(indexSizeMB as INT)/1024 AS varchar(100)),
	unusedSizeMB=cast(CAST(unusedSizeMB as INT)/1024 AS varchar(100))
	
insert #TempTableMainGB
select * from #TempTableMainMB

update #TempTableMainGB
set reservedSizeGB=cast(CAST(reservedSizeGB as INT)/1024 AS varchar(100)),
	dataSizeGB=cast(CAST(dataSizeGB as INT)/1024 AS varchar(100)),
	indexSizeGB=cast(CAST(indexSizeGB as INT)/1024 AS varchar(100)),
	unusedSizeGB=cast(CAST(unusedSizeGB as INT)/1024 AS varchar(100))

--display of results
SELECT * FROM #TempTableMain order by 1
SELECT * FROM #TempTableMainMB ORDER BY 1
SELECT * FROM #TempTableMainGB ORDER BY 1

--Final cleanup
DROP TABLE #TempTable
DROP TABLE #TempTableMain
DROP TABLE #TempTableMainMB
DROP TABLE #TempTableMainGB
drop table #tableName]]></description>
		<content:encoded><![CDATA[<p>Query to find table size for all tables of each database in a server:</p>
<p>DECLARE @DatabaseName VARCHAR(100)<br />
DECLARE @SQL VARCHAR(max)</p>
<p>&#8211;Main table to keep all data<br />
CREATE TABLE #TempTableMain<br />
(<br />
	databaseName varchar(100),<br />
    tableName varchar(100),<br />
    numberofRows varchar(100),<br />
    reservedSize varchar(50),<br />
    dataSize varchar(50),<br />
    indexSize varchar(50),<br />
    unusedSize varchar(50)<br />
)</p>
<p>&#8211;table to keep data per database and then truncate for the next database<br />
CREATE TABLE #TempTable<br />
(<br />
    tableName varchar(100),<br />
    numberofRows varchar(100),<br />
    reservedSize varchar(50),<br />
    dataSize varchar(50),<br />
    indexSize varchar(50),<br />
    unusedSize varchar(50)<br />
)</p>
<p>&#8211;table to store tablenames in a particular database<br />
create table #tableName (name varchar(100))</p>
<p>&#8211;Cursor for running query per database<br />
DECLARE databaseCursor CURSOR<br />
FOR select [name] from msdb.sys.databases<br />
where [name] not in (&#8216;master&#8217;,'tempdb&#8217;,'model&#8217;,'msdb&#8217;)</p>
<p>OPEN databaseCursor<br />
FETCH NEXT FROM databaseCursor INTO @DatabaseName<br />
WHILE (@@Fetch_Status &gt;= 0)<br />
BEGIN<br />
			&#8211;storing tableNames of a particuler database in a temp table<br />
			SELECT @SQL = &#8216;use &#8216;+@DatabaseName+&#8217;<br />
			insert into #tableName<br />
			select [name] from sys.tables&#8217;<br />
			exec(@SQL)</p>
<p>			&#8211;soring table information in temp table<br />
			SELECT @SQL =<br />
			COALESCE(@SQL + CHAR(13) + &#8216; &#8216; ,&#8221;) +<br />
			&#8216;<br />
			use &#8216;+  @DatabaseName+&#8217;<br />
			INSERT  #TempTable<br />
				EXEC sp_spaceused &#8216;+name<br />
				from #tableName<br />
		        print @SQL<br />
		        exec (@SQL)</p>
<p>		    &#8211;storing data for the current database in the main table<br />
			INSERT #TempTableMain<br />
			select @DatabaseName,* from #TempTable</p>
<p>		    &#8211;truncating temp tables for next run<br />
		    truncate table #tableName<br />
			truncate table #TempTable</p>
<p>FETCH NEXT FROM databaseCursor INTO @DatabaseName<br />
END<br />
CLOSE databaseCursor<br />
DEALLOCATE databaseCursor</p>
<p>&#8211;tables to get size in MB and GB<br />
&#8211;this part is optional and configurable as per user and usage<br />
CREATE TABLE #TempTableMainMB<br />
(<br />
	databaseName varchar(100),<br />
    tableName varchar(100),<br />
    numberofRows varchar(100),<br />
    reservedSizeMB varchar(50),<br />
    dataSizeMB varchar(50),<br />
    indexSizeMB varchar(50),<br />
    unusedSizeMB varchar(50)<br />
)</p>
<p>CREATE TABLE #TempTableMainGB<br />
(<br />
	databaseName varchar(100),<br />
    tableName varchar(100),<br />
    numberofRows varchar(100),<br />
    reservedSizeGB varchar(50),<br />
    dataSizeGB varchar(50),<br />
    indexSizeGB varchar(50),<br />
    unusedSizeGB varchar(50)<br />
)</p>
<p>insert #TempTableMainMB<br />
select * from #TempTableMain</p>
<p>&#8211;Remove &#8216;KB&#8217; from tables<br />
update #TempTableMainMB<br />
set reservedSizeMB=REPLACE(reservedSizeMB,&#8217; KB&#8217;,&#8221;),<br />
	dataSizeMB=REPLACE(dataSizeMB,&#8217; KB&#8217;,&#8221;),<br />
	indexSizeMB=REPLACE(indexSizeMB,&#8217; KB&#8217;,&#8221;),<br />
	unusedSizeMB=REPLACE(unusedSizeMB,&#8217; KB&#8217;,&#8221;)</p>
<p>update #TempTableMainMB<br />
set reservedSizeMB=cast(CAST(reservedSizeMB as INT)/1024 AS varchar(100)),<br />
	dataSizeMB=cast(CAST(dataSizeMB as INT)/1024 AS varchar(100)),<br />
	indexSizeMB=cast(CAST(indexSizeMB as INT)/1024 AS varchar(100)),<br />
	unusedSizeMB=cast(CAST(unusedSizeMB as INT)/1024 AS varchar(100))</p>
<p>insert #TempTableMainGB<br />
select * from #TempTableMainMB</p>
<p>update #TempTableMainGB<br />
set reservedSizeGB=cast(CAST(reservedSizeGB as INT)/1024 AS varchar(100)),<br />
	dataSizeGB=cast(CAST(dataSizeGB as INT)/1024 AS varchar(100)),<br />
	indexSizeGB=cast(CAST(indexSizeGB as INT)/1024 AS varchar(100)),<br />
	unusedSizeGB=cast(CAST(unusedSizeGB as INT)/1024 AS varchar(100))</p>
<p>&#8211;display of results<br />
SELECT * FROM #TempTableMain order by 1<br />
SELECT * FROM #TempTableMainMB ORDER BY 1<br />
SELECT * FROM #TempTableMainGB ORDER BY 1</p>
<p>&#8211;Final cleanup<br />
DROP TABLE #TempTable<br />
DROP TABLE #TempTableMain<br />
DROP TABLE #TempTableMainMB<br />
DROP TABLE #TempTableMainGB<br />
drop table #tableName</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pooja tedia</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-232312</link>
		<dc:creator><![CDATA[Pooja tedia]]></dc:creator>
		<pubDate>Fri, 06 Jan 2012 09:38:32 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-232312</guid>
		<description><![CDATA[How can we count No of rows in table without using Count (*) or without Count keyword?]]></description>
		<content:encoded><![CDATA[<p>How can we count No of rows in table without using Count (*) or without Count keyword?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rose</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-231149</link>
		<dc:creator><![CDATA[Rose]]></dc:creator>
		<pubDate>Wed, 04 Jan 2012 09:40:30 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-231149</guid>
		<description><![CDATA[To know the number of columns in order to create a matrix. Dont want the user to specify it.]]></description>
		<content:encoded><![CDATA[<p>To know the number of columns in order to create a matrix. Dont want the user to specify it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-231103</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 04 Jan 2012 08:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-231103</guid>
		<description><![CDATA[Why do you want to do this?]]></description>
		<content:encoded><![CDATA[<p>Why do you want to do this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rose</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-229884</link>
		<dc:creator><![CDATA[Rose]]></dc:creator>
		<pubDate>Mon, 02 Jan 2012 06:54:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-229884</guid>
		<description><![CDATA[How to get number of columns from select query :
Example:

select xx, yy from trade where ....

number of columns is 2 in this case, is there a way to find out dynamically?? Please help]]></description>
		<content:encoded><![CDATA[<p>How to get number of columns from select query :<br />
Example:</p>
<p>select xx, yy from trade where &#8230;.</p>
<p>number of columns is 2 in this case, is there a way to find out dynamically?? Please help</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: raju</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-179876</link>
		<dc:creator><![CDATA[raju]]></dc:creator>
		<pubDate>Mon, 17 Oct 2011 10:28:41 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-179876</guid>
		<description><![CDATA[select top(10) column_name from information_schema.columns where table_name = &#039;yourtablename&#039;]]></description>
		<content:encoded><![CDATA[<p>select top(10) column_name from information_schema.columns where table_name = &#8216;yourtablename&#8217;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mohan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-172301</link>
		<dc:creator><![CDATA[mohan]]></dc:creator>
		<pubDate>Mon, 26 Sep 2011 21:19:08 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-172301</guid>
		<description><![CDATA[Please use for above code it changed to some other during copy paste into HTML i believe.
Set @s= &#039;&#039;  --single quote twice.]]></description>
		<content:encoded><![CDATA[<p>Please use for above code it changed to some other during copy paste into HTML i believe.<br />
Set @s= &#8221;  &#8211;single quote twice.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mohan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-172044</link>
		<dc:creator><![CDATA[Mohan]]></dc:creator>
		<pubDate>Mon, 26 Sep 2011 09:16:46 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-172044</guid>
		<description><![CDATA[---Try for Pubs database  which has default schema name dbo  or make a table with default schema else  you need to add parameter for procedure for schema.

CREATE procedure TopNcolumns 
(
	@tableName varchar(100),
	@n int
               
)  
as    
Declare @s varchar(2000)    
set @s=&#039;&#039;  
If @n&gt;0   
Begin  

DECLARE @column_n varchar(30)
declare @temp int
set @temp=1
DECLARE @getcolumn_n  CURSOR
SET @getcolumn_n = CURSOR FOR
SELECT column_name
FROM 	information_schema.columns where table_name=@tableName order by 
		ordinal_position   
OPEN @getcolumn_n
FETCH NEXT
FROM @getcolumn_n INTO @column_n
WHILE @temp&lt;=@n
BEGIN
set @temp=@temp+1
set @s=@s+&#039;,&#039;+ @column_n 
PRINT @column_n
FETCH NEXT
FROM @getcolumn_n INTO @column_n
END
CLOSE @getcolumn_n
DEALLOCATE @getcolumn_n

Set @s=substring(@s,2,len(@s)-1)  
Exec (&#039;Select &#039;+@s+&#039; from &#039;+@tablename)  
End
Else 
Print &#039; 0 clumn passed as parameter&#039;

----now try this.......
exec TopNcolumns &#039;jobs&#039; ,3]]></description>
		<content:encoded><![CDATA[<p>&#8212;Try for Pubs database  which has default schema name dbo  or make a table with default schema else  you need to add parameter for procedure for schema.</p>
<p>CREATE procedure TopNcolumns<br />
(<br />
	@tableName varchar(100),<br />
	@n int</p>
<p>)<br />
as<br />
Declare @s varchar(2000)<br />
set @s=&#8221;<br />
If @n&gt;0<br />
Begin  </p>
<p>DECLARE @column_n varchar(30)<br />
declare @temp int<br />
set @temp=1<br />
DECLARE @getcolumn_n  CURSOR<br />
SET @getcolumn_n = CURSOR FOR<br />
SELECT column_name<br />
FROM 	information_schema.columns where table_name=@tableName order by<br />
		ordinal_position<br />
OPEN @getcolumn_n<br />
FETCH NEXT<br />
FROM @getcolumn_n INTO @column_n<br />
WHILE @temp&lt;=@n<br />
BEGIN<br />
set @temp=@temp+1<br />
set @s=@s+&#039;,&#039;+ @column_n<br />
PRINT @column_n<br />
FETCH NEXT<br />
FROM @getcolumn_n INTO @column_n<br />
END<br />
CLOSE @getcolumn_n<br />
DEALLOCATE @getcolumn_n</p>
<p>Set @s=substring(@s,2,len(@s)-1)<br />
Exec (&#039;Select &#039;+@s+&#039; from &#039;+@tablename)<br />
End<br />
Else<br />
Print &#039; 0 clumn passed as parameter&#039;</p>
<p>&#8212;-now try this&#8230;&#8230;.<br />
exec TopNcolumns &#039;jobs&#039; ,3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Molter</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-159602</link>
		<dc:creator><![CDATA[Tim Molter]]></dc:creator>
		<pubDate>Fri, 19 Aug 2011 20:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-159602</guid>
		<description><![CDATA[SELECT sysobjects.Name [TableName], sysindexes.Rows
FROM sysobjects
JOIN sysindexes ON sysobjects.id = sysindexes.id
WHERE type = &#039;U&#039; AND sysindexes.IndId &lt; 2
ORDER BY 1,2]]></description>
		<content:encoded><![CDATA[<p>SELECT sysobjects.Name [TableName], sysindexes.Rows<br />
FROM sysobjects<br />
JOIN sysindexes ON sysobjects.id = sysindexes.id<br />
WHERE type = &#8216;U&#8217; AND sysindexes.IndId &lt; 2<br />
ORDER BY 1,2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: selva</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-151092</link>
		<dc:creator><![CDATA[selva]]></dc:creator>
		<pubDate>Wed, 27 Jul 2011 17:08:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-151092</guid>
		<description><![CDATA[Hi all

when i export to csv file from ssrs2008  one extra row is displaying header,  how to hide that particular row ?????????

Thank]]></description>
		<content:encoded><![CDATA[<p>Hi all</p>
<p>when i export to csv file from ssrs2008  one extra row is displaying header,  how to hide that particular row ?????????</p>
<p>Thank</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amrit</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-146618</link>
		<dc:creator><![CDATA[Amrit]]></dc:creator>
		<pubDate>Thu, 07 Jul 2011 10:19:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-146618</guid>
		<description><![CDATA[Thanks a lot]]></description>
		<content:encoded><![CDATA[<p>Thanks a lot</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-145750</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Mon, 04 Jul 2011 11:23:28 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-145750</guid>
		<description><![CDATA[You need to use dynamic sql
This may help you
http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/select-data-from-top-n-columns.aspx]]></description>
		<content:encoded><![CDATA[<p>You need to use dynamic sql<br />
This may help you<br />
<a href="http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/select-data-from-top-n-columns.aspx" rel="nofollow">http://beyondrelational.com/blogs/madhivanan/archive/2007/08/27/select-data-from-top-n-columns.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nithiya</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-145022</link>
		<dc:creator><![CDATA[nithiya]]></dc:creator>
		<pubDate>Fri, 01 Jul 2011 04:36:34 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-145022</guid>
		<description><![CDATA[Hi,
  How to get first 10 columns from a table without mentioning the column name in sql query]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
  How to get first 10 columns from a table without mentioning the column name in sql query</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vikas</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-133950</link>
		<dc:creator><![CDATA[Vikas]]></dc:creator>
		<pubDate>Wed, 11 May 2011 09:42:21 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-133950</guid>
		<description><![CDATA[Thanks for this info. Basic knowledge that i dint have :-)]]></description>
		<content:encoded><![CDATA[<p>Thanks for this info. Basic knowledge that i dint have :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: selva</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-122361</link>
		<dc:creator><![CDATA[selva]]></dc:creator>
		<pubDate>Tue, 08 Mar 2011 06:02:17 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-122361</guid>
		<description><![CDATA[in SSRS  to count rownumber

=Runningvalue(a.value, count, &quot;Dataset1&quot;)

or

=runningvalue(a.value, countdistrict, &quot;Datasetname&quot;)

or

=runningvalue(a.value, sum, &quot;groupname&quot;)]]></description>
		<content:encoded><![CDATA[<p>in SSRS  to count rownumber</p>
<p>=Runningvalue(a.value, count, &#8220;Dataset1&#8243;)</p>
<p>or</p>
<p>=runningvalue(a.value, countdistrict, &#8220;Datasetname&#8221;)</p>
<p>or</p>
<p>=runningvalue(a.value, sum, &#8220;groupname&#8221;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vanita</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-122203</link>
		<dc:creator><![CDATA[vanita]]></dc:creator>
		<pubDate>Mon, 07 Mar 2011 06:52:41 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-122203</guid>
		<description><![CDATA[How to find number of columns without using count(*) ?
Reply soon.]]></description>
		<content:encoded><![CDATA[<p>How to find number of columns without using count(*) ?<br />
Reply soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vanita</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-122201</link>
		<dc:creator><![CDATA[vanita]]></dc:creator>
		<pubDate>Mon, 07 Mar 2011 06:48:36 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-122201</guid>
		<description><![CDATA[how to find number of columns in a table without using count(*) ?
Reply soon.

Vanita]]></description>
		<content:encoded><![CDATA[<p>how to find number of columns in a table without using count(*) ?<br />
Reply soon.</p>
<p>Vanita</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-121645</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Thu, 03 Mar 2011 08:15:20 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-121645</guid>
		<description><![CDATA[Is the datatype of the column being referenced same as the one on primary key?]]></description>
		<content:encoded><![CDATA[<p>Is the datatype of the column being referenced same as the one on primary key?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hridballav Saha</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-121508</link>
		<dc:creator><![CDATA[Hridballav Saha]]></dc:creator>
		<pubDate>Wed, 02 Mar 2011 07:43:59 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-121508</guid>
		<description><![CDATA[Hi Pinal,

I am having a strange problem when assigning foreign key to a table.
the error message no.1767: foreign key references invalid table table1.
error.1750:Could not create constraint. See previous errors.

although the table table1 is already created with the primary key which the foreign key is referencing.
Please help me out.]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I am having a strange problem when assigning foreign key to a table.<br />
the error message no.1767: foreign key references invalid table table1.<br />
error.1750:Could not create constraint. See previous errors.</p>
<p>although the table table1 is already created with the primary key which the foreign key is referencing.<br />
Please help me out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eknath</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-108822</link>
		<dc:creator><![CDATA[Eknath]]></dc:creator>
		<pubDate>Fri, 31 Dec 2010 07:02:42 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-108822</guid>
		<description><![CDATA[lots of thanks for ur work.. i got my problem solved in short time for finding numbers of rows of each table.]]></description>
		<content:encoded><![CDATA[<p>lots of thanks for ur work.. i got my problem solved in short time for finding numbers of rows of each table.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Omar Faruq</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-102734</link>
		<dc:creator><![CDATA[Omar Faruq]]></dc:creator>
		<pubDate>Mon, 29 Nov 2010 06:32:29 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-102734</guid>
		<description><![CDATA[I have two table a where the coulmn is date and userid and another table emp_info contain userid,name dept now I want to find the information from emp_info who is absent in table a between two date where I may assign the holiday.


Please help me]]></description>
		<content:encoded><![CDATA[<p>I have two table a where the coulmn is date and userid and another table emp_info contain userid,name dept now I want to find the information from emp_info who is absent in table a between two date where I may assign the holiday.</p>
<p>Please help me</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ozl</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-102364</link>
		<dc:creator><![CDATA[Ozl]]></dc:creator>
		<pubDate>Fri, 26 Nov 2010 22:47:24 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-102364</guid>
		<description><![CDATA[Im having some errors here:

ON a.table_name collate database_default
= b.table_name collate database_default
GROUP BY a.table_name, a.row_count, a.data_size
ORDER BY CAST(REPLACE(a.data_size, &#039; KB&#039;, &#039;&#039;) AS integer) DESC
DROP TABLE #temp


What names should i use? i dont understand this part...

Thanks for reading!]]></description>
		<content:encoded><![CDATA[<p>Im having some errors here:</p>
<p>ON a.table_name collate database_default<br />
= b.table_name collate database_default<br />
GROUP BY a.table_name, a.row_count, a.data_size<br />
ORDER BY CAST(REPLACE(a.data_size, &#8216; KB&#8217;, &#8221;) AS integer) DESC<br />
DROP TABLE #temp</p>
<p>What names should i use? i dont understand this part&#8230;</p>
<p>Thanks for reading!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-97563</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 03 Nov 2010 10:28:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-97563</guid>
		<description><![CDATA[select width from table
where row=(select min(row) from table where width&gt;500)]]></description>
		<content:encoded><![CDATA[<p>select width from table<br />
where row=(select min(row) from table where width&gt;500)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-97557</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 03 Nov 2010 10:09:45 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-97557</guid>
		<description><![CDATA[If you use versions prior to 2005, you need to run

dbcc updateusage command to get correct count]]></description>
		<content:encoded><![CDATA[<p>If you use versions prior to 2005, you need to run</p>
<p>dbcc updateusage command to get correct count</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: selva</title>
		<link>http://blog.sqlauthority.com/2007/01/10/sql-server-query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database-find-biggest-table-in-database/#comment-97550</link>
		<dc:creator><![CDATA[selva]]></dc:creator>
		<pubDate>Wed, 03 Nov 2010 09:28:31 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/2007/01/10/query-to-find-number-rows-columns-bytesize-for-each-table-in-the-current-database/#comment-97550</guid>
		<description><![CDATA[Hi 

I need to find a row to given value then read next value of row

Example

Row      Width   
1	400
2	500
3	510
4	682

So I am find value  500  but I want display next row value 510

How to find the next row value in Sql   
 
Please reply me ,   I am waiting for your  mail..


Regards

Selva]]></description>
		<content:encoded><![CDATA[<p>Hi </p>
<p>I need to find a row to given value then read next value of row</p>
<p>Example</p>
<p>Row      Width<br />
1	400<br />
2	500<br />
3	510<br />
4	682</p>
<p>So I am find value  500  but I want display next row value 510</p>
<p>How to find the next row value in Sql   </p>
<p>Please reply me ,   I am waiting for your  mail..</p>
<p>Regards</p>
<p>Selva</p>
]]></content:encoded>
	</item>
</channel>
</rss>

