Showing posts with label interested. Show all posts
Showing posts with label interested. Show all posts

Friday, March 9, 2012

Largest tables

Hi,
Is there an easier way to determine which tables in a db are the largest other than running sp_spaceused for each table? Interested mainly in physical size.
ThanksRun DBCC UPDATEUSAGE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_dbcc_24rp.asp) to bring your statistics up to date, then you can use:SELECT so.name, 8 * Sum(si.reserved)
FROM dbo.sysobjects AS so
JOIN dbo.sysindexes AS si
ON (si.id = so.id)
ORDER BY 2 desc, 1for a good estimate.

-PatP