• Just a different slant on things...

    -- DROP TABLE #T

    GO

    --===== Create a table to store the results in

    CREATE TABLE #T

    (

    Name SYSNAME,

    FileID INT,

    FileName NVARCHAR(512),

    FileGroup VARCHAR(100),

    Size VARCHAR(20),

    MaxSize VARCHAR(20),

    Growth VARCHAR(20),

    Usage VARCHAR(20)

    )

    --===== Declare a local variable for some dynamic SQL... Could use VARCHAR(MAX) in 2k5

    DECLARE @SQL VARCHAR(8000)

    --===== Create all the commands necessary for ALL databases

    SELECT @SQL = ISNULL(@SQL+CHAR(13),'')

    + REPLACE('USE [Mydb] INSERT #T EXEC sp_helpfile','Mydb',Name)

    FROM Master.dbo.SysDatabases

    --===== Execute the commands

    EXEC (@SQL)

    --===== Display the results

    SELECT * FROM #T ORDER BY Name

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)