Database File Summary

,

Simple SQL to quickly reveal the database file settings

select 	ltrim(substring(s.name, 1,20)) as logical_name, ltrim(s.filename) as physical_name,
	case when s.maxsize = -1 then 'Unlimited File Growth' else convert(varchar(20),s.maxsize*8/1024)+'(MB)' end as maximum_size,
	'~'+space(1)+ convert(varchar(20),s.size*8/1024)+'(MB)' as physical_file_size  ,
	case when s.status & 0x100000 = 0x100000 then (select convert(varchar(20), cast(growth as varchar(10)))+'%'   from sysfiles where fileid = s.fileid) else cast(convert(varchar(20), s.growth*8/1024) as varchar(10))+'(MB)' end as growth,
	case when s.status & 0x100000 = 0x100000 then  'Autogrow' else 'Fixed' end as status
from sysfiles s
group by s.fileid,s.name,s.filename, s.maxsize,s.size,s.growth,s.status

Rate

Share

Share

Rate