0

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.

user3044096
  • 171
  • 1
  • 17
  • This site is for programming questions. We are not general software/OS tech support. – Marc B Feb 04 '15 at 14:18
  • .mdf files are Microsoft SQL Server Database files that are used for Programmers. – user3044096 Feb 04 '15 at 14:22
  • 2
    and spaghetti is food eaten by programmers, yet you don't see cooking questions here. you're not asking for programming help. you're asking for what boils down to systems administration/recovery, which is offtopic. – Marc B Feb 04 '15 at 14:26
  • If this is not a question suitible here, why do I have tags that suits my specific problem?, I guess that if this wasn't an appropiate here, StackOverflow wouldn't give me those tags. There's a tag called mdf, and I'm asking about mdf files, there's a tag called data-Recovery, and this question is about that, there's a tag called file-recovery, and this question is about that, there's a tag called database and this question is about that too. – user3044096 Feb 04 '15 at 14:32
  • Tags are tags. Just because it exists doesn't mean it'll apply to YOUR particular situation. You're not asking about code, you don't have ANY code, you're asking how to recover a database, and THAT'S NOT PROGRAMMING. – Marc B Feb 04 '15 at 14:34
  • 1
    Anger management isn't programming either, though some programmers could benefit from it :) – MetaFight Feb 04 '15 at 14:35
  • I'm not asking "how to recover a database", please learn to read. I asked how I get the database name for each .mdf file, which can be done programming, this is not right, because this question is about programming. – user3044096 Feb 04 '15 at 14:36

1 Answers1

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

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

Alex K.
  • 171,639
  • 30
  • 264
  • 288