user3044096
user3044096

Reputation: 171

How to see the database name of each physical Mdf file?

I formatted my pc, so I lost a lot of MDF files(Databases), using a program I was able to recover a lot of .mdf files, the thing is that they have a different name.

I have a list of mdf files, for example:

folder: MDFiles Content: f324324234.mdf, f908908445.mdf..etc.

My question is, How do I get the database name of each .mdf file.

I KNOW IT CAN BE DONE, because I downloaded a program(Systools) and it does it, the only problem is that I'd have to do it one at a time, and I want to see all because I have more than 150 .mdf files.

PS. I ask this question here, because this is a situation that other programmers might have had before.

Upvotes: 0

Views: 924

Answers (1)

Alex K.
Alex K.

Reputation: 175816

DBCC CHECKPRIMARYFILE ('C:\WOOPS\XXXX.MDF', X) 

Where X is 2 for the DB name and 3 for the original file details.

Upvotes: 3

Related Questions