How to get size info for database file using dbcc showfilestats

CREATE TABLE freefilespace
    (
         fileid       INT,
         filegroup    INT,
         totalextents INT,
         usedextents  INT,
         dbname       VARCHAR(256),
         filename     VARCHAR(2000)
    )


INSERT INTO freefilespace
EXEC ('DBCC showfilestats')

SELECT dbname,
       filename,
       fileid,
       filegroup,
       ( totalextents * 64 )                        filesize_kb,
       usedextents * 64                             usedsize_kb,
       ( totalextents * 64 ) - ( usedextents * 64 ) freespace_kb
FROM   freefilespace


1 comment:

Anonymous said...

The number of people have to faces the problem of data handling on daily basis, but some of them are very expert and they knows the better person to solve their data management problem. By visiting this activewizards.com they select the best data scientist according t their works needs and desire for data management.

Post a Comment

Popular Posts