Tracking database size

  •  I would like the data returned from the code below stored in a table.

    This returns two record sets for each db. 

    declare @RETURN_VALUE int

    declare @command1 nvarchar(2000)

    SET @command1 = 'EXEC ?.DBO.SP_SPACEUSED'

    exec @RETURN_VALUE = sp_MSforeachdb @command1 = @command1

    Any ideas ?

  • You can't do that as-is; sp_spaceused returns two result sets and is therefore unavailable for the INSERT .. EXEC syntax. Your best bet is probably to re-write sp_spaceused and have it do your inserts for you...

    --
    Adam Machanic
    whoisactive

  • This one might proabably be interesting to you:

    http://vyaskn.tripod.com/track_sql_database_file_growth.htm

    --
    Frank Kalis
    Microsoft SQL Server MVP
    Webmaster: http://www.insidesql.org/blogs
    My blog: http://www.insidesql.org/blogs/frankkalis/[/url]

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

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