July 10, 2008 at 5:56 am
Hi Experts,
How to get the size of tables in a database???
TIA
July 10, 2008 at 8:19 am
July 10, 2008 at 10:57 pm
Hello Seeker,
you may use the following command to get the table size
USE db1
GO
EXEC sp_spaceused N'dbo.orders'
GO
it will return you some fields, including the tablesize and index size.
Please let me know, if that suits to your requirement.
nkgupta
July 11, 2008 at 5:35 am
Or if you only want a fast row count, you can use:
SELECT left(o.name,50)as [TableName]
,i.rowsas [RowCount]
FROM SYS.sysobjectso
INNER JOIN SYS.sysindexesi
ON (o.id = i.id)
WHERE o.xtype = 'u'
AND i.indid < 2
(With thanks to whoever first posted this here on SQLServerCentral.com)
Also, be warned:
This SQL Server 2000 system table is included as a view
for backward compatibility. We recommend that you use
the current SQL Server system views instead.
To find the equivalent system view or views,
see Mapping System Tables to System Views.
(...but I have yet to find any equivalent system view or views.)
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply