I want to attach a database to SQL Server 2005 but I have only its .mdf
file
How can I attach it?
I want to attach a database to SQL Server 2005 but I have only its .mdf
file
How can I attach it?
E.g like this:
CREATE DATABASE AdventureWorks2012 ON (FILENAME = '{drive}:\{file path}\AdventureWorks2012_Data.mdf') FOR ATTACH_REBUILD_LOG;
Simply,When you attach database, it will display Attach Database
dialog box in which click the logfile location and click the remove button. When you click OK, a logfile for you database will be created....
When you attach the mdf via the UI, select the ldf file in the list of files and remove it. A new one will be created.