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: Thursday, May 15, 2014 6:55 PM
Points: 19, Visits: 53
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: Today @ 8:50 AM
Points: 1,510, Visits: 2,703
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