user1725414
user1725414

Reputation: 11

Use mdf file that was created with visual studio 2008 on another computer

I created a database with Visual Studio 2008 and I have a file in c:\data.mdf how I can use it on another computer?

I can't use this database, I installed SQL Server Express 2005 - that install is on the first machine.

Upvotes: 1

Views: 347

Answers (2)

tempidope
tempidope

Reputation: 873

To move a database from one location to another,

you need to

1. Detach from your source database server: Since you are using Visual Studio 2008 on your source machine, go to Server Explorer - Right click on Databases - Click on Detach.

2. Copy MDF & LDF file to target machine

3. Attach MDF file to your destination database server: Repeat step 1 on target machine's SQL Server, and Instead of Detach - Choose Attach and select the relevant MDF file.

Upvotes: 1

Steve Wellens
Steve Wellens

Reputation: 20638

You do not access an mdf file directly, you always go through the server.

To 'tell' Sql Server about the database:

Goto the Object Explorer window.
Right click Databases.
Select Attach...
Then Add...

Upvotes: 0

Related Questions