New answers tagged recovery
The answer is yes ONLY if the files are not in use. USE [master] GO CREATE DATABASE [YourDataBase] ON ( FILENAME = N'Path....\FileName1_Data.MDF' ),-- Data files (mdf/ndf) ( FILENAME = N'Path....\FileName2_log.ldf' ) -- log files (ldf) FOR ATTACH GO
You can first check to make sure it actually is a valid MDF file using DBCC CHECKPRIMARYFILE. It is an undocumented command but can be useful at times. If that turns up nothing or shows that it is not a mdf file you can use the RESTORE HEADERONLY to see if it might be a backup file. To your specific question, yes you can attach this as a different database ...
The first issue was someone denied the SQL Server Services in the NDF and MDF files and once that denied was removed and granted appropriate access, the first issue was resolved. The second solution was that corrupt NDF file had no data so I removed it and database was back online.
Top 50 recent answers are included