I have suddenly deleted a sql server databse file from Sql server management studio. and recovered it using a data recovery software. but now unable to open this database. the error is "aaa.mdf is not a primary database file error 5171". i need urgent solution plz. help me to solve this issue. it is very urgent

This article: http://social.msdn.microsoft.com/forums/en-US/sqldatabaseengine/thread/d199eb76-7eea-40ef-afe6-7e0dee6b7015/
recommends the usage of sp_attach_single_file_db to attach the mdf to somebody with the same error, but different cause.

It seems that it's either a corrupted mdf or that you are missing the ldf (log file). You might want to try to recover the log file as well - or just go ahead and use (or even better google and the use) sp_attach_single_file_db.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.