How to find the free space in Database files?


01 select
02 a.FILEID,
03 [FILE_SIZE_MB] =
04 convert(decimal(12,2),round(a.size/128.000,2)),
05 [SPACE_USED_MB] =
06 convert(decimal(12,2),round(fileproperty(a.name,'SpaceUsed')/128.000,2)),
07 [FREE_SPACE_MB] =
08 convert(decimal(12,2),round((a.size-fileproperty(a.name,'SpaceUsed'))/128.000,2)) ,
09 NAME = left(a.NAME,15),
10 FILENAME = left(a.FILENAME,30)
11 from
12 dbo.sysfiles a

The Script will provide you how much space is actually being used and how much is still available for it to grow further.

Comments

Popular posts from this blog

GOVERNMENT OF RAJASTHAN TEACHER TRANSFER LIST 2014

Orientation change shortcuts for emulator and simulator

Constructor in C#