How to transfer ASP.NET MVC Database from LocalDb to SQL Server?

doncadavona picture doncadavona · Mar 18, 2015 · Viewed 43.7k times · Source

I created a new ASP.NET MVC 5 project in Visual Studio 2013 (Express for Web) and by default, the project uses LocalDb as its database, but how do you transfer or migrate the database to SQL Server?

I want to use SQL Server for the database instead of LocalDb. But how?

Answer

Overlord picture Overlord · Oct 31, 2016

Notwithstanding this question is old, the answer didn't help me so I want to share how I solved it for my self.

On Server Explorer, find your ASPNet DB. Then open it using SQL Server Object Explorer.

enter image description here

Then go and hit Schema Compare option

Compare Schemas

Then on the the Schema Compare window for the Target database, select the SQL Server data base you want the ASPNet DB to integrate to. Then hit Compare button

Set Options

Deselect all Delete actions for the target database, and leave selected all Add actions for the ASPNet DB, then hit Update button.

Update

Finally, update your connection string so it points to your SQL Server DB