Sql 2005
I'm a little confused when looking at how much space my database is using.
According to the management studio, when I right click on the database and go to properties, it reports the size at 256046.19 MB (250.04511 GB).
I used the following SQL to give me a complete list of all the table sizes in this database:
When I converted all the sizes to numbers (everything is in KB), I added everything up and used the following to calculate GB: x/1024/1024. This resulted in (leaving out the unused space column): 18.34009552 GB. I looked up any full text catalogs I had (there were two), and their sizes were 706 MB and 0 MB. Adding that into the total still leaves only around 20GB.
What is with the big difference 250 GB vs 20 GB?
Can anybody help me find the missing space?
I'm a little confused when looking at how much space my database is using.
According to the management studio, when I right click on the database and go to properties, it reports the size at 256046.19 MB (250.04511 GB).
I used the following SQL to give me a complete list of all the table sizes in this database:
Code:
CREATE TABLE #tempSpace(
[name] nvarchar(255),
[rows] char(11),
reserved varchar(18),
data varchar(18),
index_size varchar(18),
unused varchar(18) )
DECLARE @tableSql varchar(255)
DECLARE tableSpaceCur CURSOR FOR
SELECT 'INSERT INTO #tempSpace exec sp_spaceused '+TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME
OPEN tableSpaceCur
FETCH NEXT FROM tableSpaceCur INTO @tableSql
WHILE (@@FETCH_STATUS <> -1)
BEGIN
PRINT @tableSql
EXEC(@tableSql)
FETCH NEXT FROM tableSpaceCur INTO @tableSql
END
DEALLOCATE tableSpaceCur
SELECT * FROM #tempSpace
DROP TABLE #tempSpace
What is with the big difference 250 GB vs 20 GB?
Can anybody help me find the missing space?