jbates99
Constraint Violating Yak Guru
396 Posts |
Posted - 12/25/2012 : 14:45:00
|
I want to track the size of every database's data file into a table so I can project future growth patterns.
Does anyone have a solid technique, that can be ran programatically?
Note - I don't the file size - that is how much space that's allocated. I want to find the amount of space actually used. If the data file were shrunk to minimum size, if that makes sense.
Thanks for any tips. Jack |
|
v_yaduvanshi
Starting Member
India
11 Posts |
Posted - 12/26/2012 : 05:19:50
|
u may check this
Select db_name(),fileid,case when groupid = 0 then 'log file' else 'data file' end, name,filename, [file_size] = convert(int,round((sysfiles.size*1.000)/128.000,0)), [space_used] =convert(int,round(fileproperty(sysfiles.name,'SpaceUsed')/128.000,0)), [space_left] =convert(int,round((sysfiles.size-fileproperty(sysfiles.name,'SpaceUsed'))/128.000,0)) from dbo.sysfiles;
|
 |
|