Chris Gierlack
SSCrazy
Points: 2326
More actions
July 28, 2009 at 10:01 am
#385072
What is the t-sql syntax for getting the actual space used in an mdf?
Ken Simmons
SSCertifiable
Points: 7822
July 28, 2009 at 1:03 pm
#1031262
Try this...
SELECT D.name,
CAST(CAST((D.SIZE * 8 / 1024.0) AS DECIMAL(18,2)) AS VARCHAR(20)) FILESIZE_MB,
CAST((D.SIZE * 8 / 1024.0) - (fileproperty(Name,'SpaceUsed') / 128.0) AS DECIMAL(15,2)) SPACEFREE_MB
FROM sysfiles D
July 28, 2009 at 3:45 pm
#1031374
That's it. Thanks.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply