Click here to Skip to main content
15,946,988 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm trying to attach .mdf files in a newly built SQL Server 2008 R2.
Everytime I try to attach .mdf files, it gives me an error "Is not a primary databse file, Microsoft SQL Server, Error: 5171".
Seems like .mdf files got damaged due unreadable header. Pls give some suggestions to attach my database.
Updated 13-Mar-16 19:03pm

Share this answer
GDdixit 13-May-13 5:20am    
no .. this is not going to be happy , problem is as maintain as before , now i think i have to work on all database manually ...sit
you can follow above steps:-

1]open sql server
2]connect your DB
3]Right click on Database
4]click on Restore Databse
5]Add the name you want to give in (To database)
6]select your backup db from device
7] check the checkbox that appear with your db name
Share this answer
Get a look of this:

SQL Server Management Studio: attach database [^]

I'd like I was helpful.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900