• steveb (11/12/2008)


    try this code to get the file paths for each db on a server.

    DROP TABLE #DBFiles

    CREATE TABLE #DBFiles

    (

    [DBName] [nvarchar](100),

    [Name] [nvarchar](100),

    [Filename] [nvarchar](100)

    )

    ON [PRIMARY]

    INSERT INTO

    #DBFiles

    EXEC sp_MSforeachdb 'Select ''?'' as DatabaseName, [?]..sysfiles.name,

    [?]..sysfiles.filename From [?]..sysfiles'

    SELECT

    *

    FROM

    #DBFiles

    Hi steveb,

    I am not getting "sp_MSforeachdb" in Sql Server online help. Where shall i get the information for the same.

    ---