How to get Logical file name of .bak (using script)

  • Hi there

    I want to get the logical file name (logical name of mdf and logical name of ldf) of a .bak file using script

    Cheers

  • You may use RESTORE FILELISTONLY as in the below example.

    RESTORE FILELISTONLY FROM DISK='E:\MyBackup.bak'

    Pradeep Adiga
    Blog: sqldbadiaries.com
    Twitter: @pradeepadiga

  • Hi,

    If you want to see a particular database logical name. you can run this query

    select * from sysfiles.

    otherwise, u want to see logical name for all databases. you can use this query

    use master

    select * from sysaltfiles

    Thanks & Regards

    Balaji.G

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

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