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:

54 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.

  4. I have noticed that of all different types of insurance, medical health insurance is the most controversial because of the discord between the insurance cover company’s necessity to remain making money and the buyer’s need to have insurance coverage. Insurance companies’ commissions on health plans are certainly low, as a result some companies struggle to earn profits. Thanks for the thoughts you talk about through this blog.

Leave a Reply

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