Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Old Forums
 CLOSED - General SQL Server
 Attaching mdf file.
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Yak Posting Veteran

60 Posts

Posted - 03/27/2007 :  10:40:49  Show Profile
Rarely I need to perform detach/attach stuff during my development. However, I have to develop an application that use sql server user instance (I am not sure I call it right) this recently.

My problem is each time I detach .mdf file from one machine located at, say: D:\Data\Db.mdf. Once after I trasfer this file to other machine at: C:\Db.mdf, then I try to attach this .mdf file. What cause the problem here is sql server doesn't
allow me to attach the file unless I have the .mdf file corresponding .ldf file.

My thought is that sql server should allow me to attach the file and create a .ldf file if it doesn't find one. Any idea why this happen?

Thanks for any reply.


Flowing Fount of Yak Knowledge

5581 Posts

Posted - 03/27/2007 :  10:57:23  Show Profile  Visit harsh_athalye's Homepage  Click to see harsh_athalye's MSN Messenger address  Send harsh_athalye a Yahoo! Message
Try using sp_attach_single_file_db.

Harsh Athalye
Go to Top of Page

Yak Posting Veteran

60 Posts

Posted - 03/27/2007 :  11:09:04  Show Profile
Thanks harsh for the stored procedures. I will try it out tomorrow to see whether it works. Thanks. :)

Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2019 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.26 seconds. Powered By: Snitz Forums 2000