Need help to track unallocated space on a database

  • Hi experts,

    I am trying to track unallocated space (because on my database growth is not kicking in) So using below query but not working!!! Is there any way I can track 'database size' and 'unallocated space' on a single database?

    create table A(

    Rundate DATETIME NOT NULL DEFAULT(GETDATE())

    ,DatabaseName varchar(100)

    ,Database_size varchar (100)

    ,unallocatedSpace varchar (100)

    ,reserved varchar(100)

    ,data varchar(100)

    ,index_size varchar(100),

    unused varchar(100))

    Go

    insert into A (

    DatabaseName

    ,Database_size

    ,unallocatedSpace

    ,reserved

    ,data

    ,index_size

    ,unused

    )

    exec AdventureWork..sp_spaceused ------not working------

  • If you just need to monitor database/filegroup free space you can use my script here: http://spaghettidba.com/2014/09/05/database-free-space-monitoring-the-right-way/

    However, FILEPROPERTY(filename,'SpaceUsed') will tell you how much free space there is in a database file.

    -- Gianluca Sartori

  • Thanks spaghettidba, I was just looking for to track 'space available'/'unallocated space' thru a table on A database.

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

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