Question

I am developing a software with vb.net 2010 and sql server 2008 R2. While developing with my laptop where sql server is running every thing is ok, but when I want to deliver the project to the customer I must install sql server R2 to customer machine. How to get my database .mdf format to use it with my project. Thankyou

Was it helpful?

Solution

You need to detach the mdf file from your computer and then copy that file to your storage device of your choice say a USB. Afterwards if there is already an installed SQL server in your client you could copy the mdf file that you detach and then attach that mdf file this time.

To Detach:

  • Right Click on the Database that you want to Detach then Task --> Detach

enter image description here

To Attach:

  • Right Click on the word Databases then Attach

enter image description here

Don't forget of course to Attach again in your own computer the Database that you detached earlier.

OTHER TIPS

Just make a backup of your database and restore it on the client's machine.

You can do this either with Visual Studio:

...or with T-SQL:

Detaching and attaching the database (as described in the other answer) is possible too, but the recommended way is making a backup.
Plus, if you are running at least SQL Server 2008 R2 Standard Edition on your laptop, you can use SQL Server's built-in backup compression, which will significantly reduce the size of the backup file (compared to the regular database size).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top