Free space in mdf

  • Hi!

    I would like to ask what is the filesize, usedspace and freespace means in mdf? whats the difference of the 3? 

    Thanks

  • This was removed by the editor as SPAM

  • As Jason clearly mentioned.

    File Size:Total Space taken by the file
    UsedSpace: Space used within that taken value.
    Freespace:its the free value available within the file .

    In short FileSize=UsedSPace + FreeSpace

    Use below query to get the  details 

    USE [yourDB]
    Select a.FILEID,
    [FILE_SIZE_MB] =       convert(decimal(12,2),round(a.size/128.000,2)),
    [SPACE_USED_MB] =       convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)),
    [FREE_SPACE_MB] =       convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) ,
    NAME = left(a.NAME,15)
    from sysaltfiles a

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

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