Tuesday 10 November 2009

Big tables in SQLServer

SELECT
    [TableName] = so.name,
    [RowCount] = MAX(si.rows)
FROM
    sysobjects so,
    sysindexes si
WHERE
    so.xtype = 'U'
    AND
    si.id = OBJECT_ID(so.name)
GROUP BY
    so.name
ORDER BY
    2 DESC

 

That’ll give you the ones with lots of rows, then use the following SP, to get the sizes:

sp_spaceused 'PRODDTA.F4211'
sp_spaceused 'PRODDTA.F49211'
sp_spaceused 'PRODDTA.F42199'
sp_spaceused 'PRODDTA.F4111'
sp_spaceused 'PRODDTA.F41051'

No comments: