• Thanks for the script. Found a slight problem though: with database names that have funky characters in them, especially a period, this will throw an error (as wakanni found). I placed brackets around the @vcDatabaseName in the EXEC statement:

    EXEC ('

    INSERT INTO ##tbl_DataSize

    SELECT CAST((SUM(size)) as DECIMAL(20,3)) FROM ['+@vcDatabaseName+'].dbo.sysfiles'

    )

    No more errors for me.

    ----------------------------------------------------------------------------
    Sacramento SQL Server users group - http://sac.sqlpass.org
    Follow me on Twitter - @SQLDCH
    ----------------------------------------------------------------------------

    Yeah, well...The Dude abides.