﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / Find out the size of database tables, row count, data size, index growth / 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>Sat, 25 May 2013 05:10:54 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>[quote][b]tinakothari (11/18/2012)[/b][hr]I want to create table and all columns. column names are database name, current date, row count, data size, index size.in this table i want to insert about all the tables above information for one particular database.I want to use DMV for thislet me know if you have any question.[/quote]You could try this[code="SQL"]SELECT			DB_NAME() AS DatabaseName			, object_name(i.object_id) AS TableName			, ISNULL(i.name, 'HEAP') AS IndexName			, i.index_id AS IndexID			, i.type_desc AS IndexType			, p.partition_number AS PartitionNo			, p.[rows] AS NumRows			, au.type_desc AS InType			, au.total_pages AS NumPages			, au.total_pages * 8 AS TotKBs			, au.used_pages * 8 AS UsedKBs			, au.data_pages * 8 AS DataKBsFROM sys.indexes i INNER JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_idINNER JOIN sys.allocation_units au ONCASE WHEN au.[type] in (1,3) THEN p.hobt_idWHEN au.type = 2 THEN p.partition_idend = au.container_idINNER JOIN sys.objects o ON i.object_id = o.object_idWHERE o.is_ms_shipped &amp;lt;&amp;gt; 1ORDER BY TableName, i.index_id[/code]</description><pubDate>Sun, 18 Nov 2012 14:08:51 GMT</pubDate><dc:creator>Perry Whittle</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>[quote][b]tinakothari (11/18/2012)[/b][hr]Thanks for the reply.this is now working out.can you help me with the script using dmvIt creates table and insert all the tables information about specified database[/quote]All of the information you seek is in the system objects that Gail Shaw noted in her post above.  If you need the information you state, then you should understand that information, as well.  The only way you'll understand all of that information is to read about each of those objects in Books Online and figure this one out on your own.  You won't be sorry that you did.  Think of it as a "rite of passage" that every DBA should go through. ;-)  If you have problems during your attempt, I'm sure that folks would be happy to help you with specific prroblems instead of writing the entire query for you.</description><pubDate>Sun, 18 Nov 2012 12:35:13 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>Thanks for the reply.this is now working out.can you help me with the script using dmvIt creates table and insert all the tables information about specified database</description><pubDate>Sun, 18 Nov 2012 11:29:52 GMT</pubDate><dc:creator>tinakothari</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>This might be a good start.[code="sql"]use MyDBgoDECLARE @names TABLE(  id   INT IDENTITY(1,1),  name NVARCHAR(100) NULL)DECLARE @ROWCOUNT INTDECLARE @i INT = 1DECLARE @str nvarchar(100)INSERT INTO @names(name) SELECT name FROM sys.TablesSET @ROWCOUNT = @@ROWCOUNTDECLARE @space TABLE(  name     NVARCHAR(100) NULL,  rows     CHAR(11),  reserved NVARCHAR (15),  data     NVARCHAR (18),  indexes  NVARCHAR (18),  unused   NVARCHAR (18))WHILE @i &amp;lt;= @ROWCOUNTBEGIN  SELECT @str = name FROM @names WHERE id = @i  INSERT INTO @space  EXEC   sp_spaceused @str  SET    @i += 1ENDSELECT * FROM @spaceORDER  BY CONVERT( BIGINT, rows ) DESC;[/code]</description><pubDate>Sun, 18 Nov 2012 11:00:17 GMT</pubDate><dc:creator>Revenant</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>Not offhand, no. It's not hard though, most of the data you want is in sys.dm_db_partition_stats, you just need to join to the others to get the names.</description><pubDate>Sun, 18 Nov 2012 10:41:09 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>do you have a script for this or can you send me the script please?</description><pubDate>Sun, 18 Nov 2012 10:18:13 GMT</pubDate><dc:creator>tinakothari</dc:creator></item><item><title>RE: Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>sys.databasessys.tablessys.indexessys.dm_db_partition_stats</description><pubDate>Sun, 18 Nov 2012 10:04:13 GMT</pubDate><dc:creator>GilaMonster</dc:creator></item><item><title>Find out the size of database tables, row count, data size, index growth</title><link>http://www.sqlservercentral.com/Forums/Topic1386046-146-1.aspx</link><description>I want to create table and all columns. column names are database name, current date, row count, data size, index size.in this table i want to insert about all the tables above information for one particular database.I want to use DMV for thislet me know if you have any question.</description><pubDate>Sun, 18 Nov 2012 07:54:27 GMT</pubDate><dc:creator>tinakothari</dc:creator></item></channel></rss>