Size of the database data file (not the log file) accurately

  • Is there any T-sql that will return the size of the database data file (not the log file) accurately ?

  • -- 2005 GUI,PDR etc give great info, 2008 is even cooler, gives info on SSMS object details only

    -- For 2000

    use databasename

    go

    select

    [FileSizeMB] =

    convert(numeric(10,2),round(a.size/128.,2)),

    [UsedSpaceMB] =

    convert(numeric(10,2),round(fileproperty( a.name,'SpaceUsed')/128.,2)) ,

    [UnusedSpaceMB] =

    convert(numeric(10,2),round((a.size-fileproperty( a.name,'SpaceUsed'))/128.,2)) ,

    [DBFileName] = a.name

    from

    sysfiles a

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

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