Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Space Used By Table Expand / Collapse
Author
Message
Posted Wednesday, February 18, 2009 5:23 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Saturday, November 29, 2014 9:04 AM
Points: 22, Visits: 62
Comments posted to this topic are about the item Space Used By Table
Post #659976
Posted Wednesday, March 4, 2009 5:37 AM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, December 17, 2014 5:23 AM
Points: 1,522, Visits: 2,731
Another way to do it. . .

CREATE TABLE #temp 
(
[name] nvarchar(128),
[rows] char(11),
[reserved] varchar(18),
[data] varchar(18),
[index_size] varchar(18),
[unused] varchar(18)
)

INSERT INTO #temp
EXEC sp_MSforeachtable @command1="EXEC sp_spaceused '?' "

SELECT
[name] AS TableName,
CAST([rows] AS int) AS NumOfRows,
CAST(REPLACE([reserved],' KB','') AS int) AS [TotalKB]
FROM
#temp
ORDER BY 3 DESC

SELECT SUM(CAST(REPLACE([reserved],' KB','') AS int)) AS TotalKB_data FROM #temp

DROP TABLE #temp


Post #668051
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse