How to move a sql server express mdf file to a different sql sever express server?
-
08-07-2019 - |
Question
I'm trying to move my database.mdf file from a development environment to a SQL Server Express server that is hosted on my VPS - but I can't figure out how to attach the file to my database server. Help!
Solution
sp_attach_db
(or CREATE DATABASE FOR ATTACH) - don't forget to bring the LDF (log) files, too.
OTHER TIPS
I am not sure if you can, but you could use the Sql Studio Management Express, which allows you to connect (and then attach) the database.
Your application could also be using a local instance and directly connect to the database.mdf in the app.data folder.
While you can use detach/attach, the recommended method is to use backup/restore (don't forget: SQL Server backup is online)
This will help you
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow