How do I find the size of a table?

  • in SQl Server 2000?

  • Try sp_spaceused

  • Hi,

     

    To get the accurate size execute first

    sp_updatestats ,dbcc updateusage

    then u can use sp_spaceused

    or

    SELECT [TableName], (SELECT rows FROM sysindexes s WHERE s.indid < 2 AND s.id = OBJECT_ID(a.[TableName])) AS [Rowcount],

    [Total_space_used (MB)] From (SELECT  QUOTENAME(OBJECT_NAME(i.id)) AS [TableName],CONVERT(numeric(15,2),(((CONVERT(numeric(15,2),

    SUM(i.reserved))

    *(SELECT low FROM master.dbo.spt_values (NOLOCK) WHERE number = 1 AND type = 'E')) / 1024.)/1024.)) AS [Total_space_used (MB)]

     FROM sysindexes i (NOLOCK)Inner Join sysobjects o(NOLOCK) ON i.id = o.id AND (o.type = 'U') AND ((OBJECTPROPERTY(i.id, 'IsMSShipped') = 0))

    WHERE indid IN (0, 1, 255)

    GROUP BY  QUOTENAME(OBJECT_NAME(i.id)) ) as a ORDER BY [Total_space_used (MB)] DESC

     

    from

    killer

  • Thnaks! - both work fine

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply