Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 SQL Database is corrupted....... plz help.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 08/21/2014 :  18:25:10  Show Profile  Reply with Quote
Respected Sir,

unfortunately hard disk of my system is damaged, now i recovered my database. but it cannot be attached again to SQL management studio 2005.
the error is myfile.mdf is not a primary database file. (SQL server , error 5171)

plz sir help me...

Almighty SQL Goddess

38200 Posts

Posted - 08/21/2014 :  18:41:23  Show Profile  Visit tkizer's Homepage  Reply with Quote
Do you not have SQL backups?

What are the other file extensions in that folder? That error makes it sound like you need to attach a different file.

Tara Kizer
SQL Server MVP since 2007
Go to Top of Page

Flowing Fount of Yak Knowledge

United Kingdom
2179 Posts

Posted - 08/23/2014 :  02:39:00  Show Profile  Visit jackv's Homepage  Reply with Quote
Could you supply the full error message? Where is your primary database file?

Jack Vamvas
Go to Top of Page

Yak Posting Veteran

52 Posts

Posted - 08/23/2014 :  07:48:01  Show Profile  Reply with Quote
Hi Shampur
Unfortunately some situation happens when your efforts become useless but never lose hope. For this you must read and try some suggestions to attach MDF file.
Go to Top of Page

Posting Yak Master

212 Posts

Posted - 09/02/2014 :  04:17:35  Show Profile  Visit prett's Homepage  Reply with Quote
Hi Shampur,

Try to attach your database with 'sp_attach_db'. Another possible remedy is to use 'CREATE DATABASE' command with the 'FOR ATTACH' clause.

Click here for details:
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000