• I would change f.size to f.maxsize. case when 0, -1 use f.size.

    Also the 2005 table is sys.database_files. sys.sysfiles is only provided for backward compatibility.