Categories:

If you ever need to know what is database name based on a data or transaction log file location, run the following T-SQL code.


select d.name, m.name, m.physical_name
from sys.master_files m
inner join sys.databases d
on (m.database_id = d.database_id)
where physical_name = N'D:\Data\datafile.mdf' --change the full path file
order by 1, 2

Tags:

18 Responses

  1. join with sys.databases is not needed here
    use db_name(database_id) function to get database name

  2. 1Learn more about how to get free gems on cooking fever

    u3iauds11
    This game is a whole lot more fun when you have as many gems as you could ever want.If you like mobile games like this you ought to check out this link

  3. 100,000 Backlinks only $10,Subject to data from ahrefs.com.After paid $10 by PayPal (My PayPal:helloboy1979@gmail.com),Tell me your URL, email and comment content.I will complete the task within ten days.But It may take up to a month for the data updated from ahrefs.com.

Leave a Reply

Your email address will not be published. Required fields are marked *