Physical file name

  • SELECT Name [Database], Physical_Name [Physical file], size*8 [Size_KB] FROM sys.master_files

    where Physical_Name like '%mdf' order by name

    From the above query i am getting the list of databases but 5 of them have same dbname with different physical file name but when i look at the db's from SSMS they have different name like physical files.

  • Tara-1044200 (11/13/2009)


    SELECT Name [Database], Physical_Name [Physical file], size*8 [Size_KB] FROM sys.master_files

    where Physical_Name like '%mdf' order by name

    From the above query i am getting the list of databases but 5 of them have same dbname with different physical file name but when i look at the db's from SSMS they have different name like physical files.

    Try this instead

    SELECT db_name(database_id) [Database],Name [LogicalFileName], Physical_Name [Physical file], size*8 [Size_KB] FROM sys.master_files

    where Physical_Name like '%mdf' order by name

    The name field is the Logical Name of the File.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • Name is logical file name in this table, not the database name. Check this out:

    SELECT db_name(database_id) [Database name], Name [Logical file name], Physical_Name [Physical file], size*8 [Size_KB] FROM sys.master_files

    where Physical_Name like '%mdf' order by name

    Regards

    Piotr

    ...and your only reply is slàinte mhath

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

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