Values Sysfiles is reporting

  • I have a question about the sysfiles table.  In BOL it states that the file size info (FileSize, Growth, and Maxsize) are reported in 8 Kb Pages.  However when I view this table on  a specific server I get results that do not fit that info.

    The Query =

    select name, size, maxsize, growth from sysfiles

    The Results =

     

    name                 size        maxsize     growth     

    --------------- ----------- ----------- -----------

    productiondata    2560000     2560128     128000

    prodlog3             143953      2560000     128000

    NCINDEXData1    1280000     2560000     128000

    productiondata3  1280000     2560000     128000

    The acutal file inforamation

    name                 size        maxsize     growth     

    --------------- ----------- ----------- -----------

    productiondata    20000       20001         1000

    prodlog3             1125        20001         1000

    NCINDEXData1    20000       20001         1000

    productiondata3  20000       20001         1000

    That information shows that the size reported is in divided by 128 to get the results in MB. 

    Can someone let me know why this is.

  • You may be having rounding occuring as 128 is an integer. Intead, divide by 128.0 which is a decimal.

    select name , size sizePages

    , size * 8 as SizeKb

    , (size * 8 ) / 1024.0 as [(size * 8 ) / 1024.0]

    , (size / 128.0 ) as SizeMb_Decimal

    , (size / 128 ) as SizeMb_Integer

    from sysfiles

    SQL = Scarcely Qualifies as a Language

  • The size in sysfiles are number of pages. One page in SQL 2000 is 8 KB. To get the size in MB:

    SizeInMB=size*8.0/1024.0=size/128.0

     

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply