Today, one of my support executive was trying to attach a database received from client in SQL SERVER 2008 R2. He had received only one file, DemoDB.mdf Now when he was attaching that file, SQL server is giving below error: TITLE: Microsoft SQL Server Management Studio ------------------------------ Attach database failed for Server 'XXX-XX--XX'. (Microsoft.SqlServer.Smo)
For
help, click:
http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500.0+((KJ_PCU_Main).110617-0038+)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476 ------------------------------ ADDITIONAL INFORMATION: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ------------------------------ Directory
lookup for the file "G:\SQLLOG\NAV_D_CQPA_370B_Log.ldf" failed with the
operating system error 3(The system cannot find the path specified.).
(Microsoft SQL Server, Error: 5133) ------------------------------ I
checked the file path during attach. I found that as he does not have
the log file. SQL was taking a random path which is not exist in the
system. I removed the ldf file and the database is attached
successfully.