user3021628
user3021628

Reputation: 21

How to read an old SQL Server 2005 mdf file

I've upgraded my SQL Server 2005 to 2008, without backing up the databases. I kept the old data folder with the 2 DB.mdf and DB.ldf files.

So how can I import or read my .mdf file into SQL Server 2008 ?

If I try to use the 2008 tools import/export, I am unable to find the source because the 2005 has been replaced. Only the server 2008 is running.

If not possible, An other way, would be to read the .mdf file with vb if you know

Thank you for your help

regards Mike

Upvotes: 0

Views: 1319

Answers (3)

Remus Rusanu
Remus Rusanu

Reputation: 294457

If you attach the SQL 2005 files to an SQL 2008 instance it will know what to do with them (it will upgrade the database). Use sp_attach_db, CREATE DATABASE ... FOR ATTACH or even the management tool, How to: Attach a Database.

See Detaching and Attaching Databases.

I recommend make a copy of the files before the attach.

Upvotes: 1

vasin1987
vasin1987

Reputation: 2012

In SSMS right click Database folder --> attach then choose your data file and log file accordingly

Upvotes: 1

FeliceM
FeliceM

Reputation: 4219

Here there is a full article on how to move a Sql 2005 on 2008 sql server. Link

Upvotes: 0

Related Questions