SQL Server 2005: How to Attach (or Reattach) a Database Missing the LDF
Posted by Rob Rogers in Database
If you need to attach a database that has no log file (.LDF), or have deleted the log file because it was too big and need to reattach the database, SQL Server 2005 does allow you to do this. You can attach the database by following this Tech-Recipe:
1. Open the SQL Server Management Studio and connect to the desired server.
2. Right-click on Databases and select Attach.
3. Click the Add button and select the database file to be attached.
4. Under database details, select the .LDF file and click the Remove button.
5. Click OK.
The database will be attached with a new logfile.
About Rob Rogers
View more articles by Rob Rogers
The Conversation
Follow the reactions below and share your own thoughts.


October 03, 2008 at 7:23 pm, Veronika said:
thx a lot
December 16, 2008 at 3:01 pm, foo said:
Thanks buddy, it really helped me.
December 19, 2008 at 8:54 pm, Walter Franco said:
Hi,
I did exactly like this last month, but my database doesn´t update the log file, it stays at the same old date when i attached and only update if i restart the SQL services. Is that “normal” or I missed something?
Txs for any help!
Walter Franco
Poços de Caldas – MG
Brasil
June 05, 2009 at 2:10 am, msolih said:
before attach, rename your LDF file first.
March 12, 2009 at 4:32 pm, Mayur said:
Hello
i have one problem
plz give me solution
i want to attach script to the database of the microsoft sqlserver 2005 databse
plz give me suggetion about this topic
what to do for that
thnkyu in advance
August 24, 2009 at 7:19 am, Kopi said:
eey dawg u on point, hommie, nearly died of a heart attack, u a great deal dawg, kip it real!!!!
May 20, 2010 at 9:34 am, niranajn said:
good
May 20, 2010 at 9:34 am, niranajn said:
excallent
September 03, 2010 at 6:06 am, Shikhavalecha said:
thanks alot
October 08, 2010 at 5:41 pm, Karthika said:
i am new to sql, my bd is perfect now
May 02, 2011 at 1:58 am, AusNetIT Solutions said:
Hi,
Can we do this on SQL 2000?
Thanks,
November 10, 2011 at 5:02 pm, mony said:
very good
thanks