Attaching MDF and LDF files to SQL Server 2005

Tags:
LDF
MDF
SQL Server 2005
I have MDF and LDF files with different modified dates. How could I attach these to SQL Server 2005?

Answer Wiki

Thanks. We'll let you know when a new response is added.

Where the MDF and LDF detached from the SQL Server at the same time, if they were then you can attach them using the sp_Attach_db system stored procedure. However if they were detached at two different times they there are useless together.

You can attach the MDF file without the LDF File by using the sp_attach_single_file_db system stored procedure. This procedure will attach the database and create a new log file.

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Hhhh
    i have different problem ..i m having server 2008 at my office but server 2005 at my place..when i try to attach mdf file of server 2008 to server 2005 it doesnt allow.. is it possible to attach mdf file to the lower version or..:(
    10 pointsBadges:
    report
  • Denny Cherry
    No you can not attach a database from a newer edition to an older edition. You will need to purchase the developer edition for your home computer ($50 US) or get the trial edition of SQL Server 2008.
    66,050 pointsBadges:
    report
  • Itdonsavi
    can i attach an mdf and ldf file which was created in sql server 2000 to sql server 2005 enterprise edition?if so please explain me in steps?thanks in advance
    30 pointsBadges:
    report
  • Denny Cherry
    Yes, you can always go up, but once you attach to a newer version you will not be able to attach that same database to an older version. In SQL Management Studio, connect the object explorer to the server, then right click on databases, select all tasks, then attach database. Select the mdf file of the database you wish to attach and then click ok. The database will then be attached to the SQL 2005 instance.
    66,050 pointsBadges:
    report
  • Marllee
    i am currently working on a migration db. i have backup the mdf. and ldf. and same time i have export and import the database to the new server. do i still need to work on the mdf as mention?
    10 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following