Thursday, November 12, 2015

SQL Server: Save Database Locally

If you have a database up in the cloud or elsewhere and want to make a local copy, you start by opening up SQL Server Management Studio (this is 2014 but should be the same/similar for other versions).

Login to your local server. I used SQL Express, so my login is Windows Authentication and the server name is localhost/SQLEXPRESS. Also make sure this is running if you check in your Services on your machine.

Login to your online server. You need those credentials from your company or whatnot.

Now, start by right clicking on Datbases on your online server and hitting Export Data-tier application.

Hit Next.
Save locally somewhere. I just made a Db folder under my C drive to make it easy to find. It will save a BACPAC file.

Now, right click on Databases on your local server and hit Import Data-tier application. Find your BACPAC file you just made.

Find the BACPAC file you saved.

Hit Next and finish up with this dialog and you should have a local copy imported into your local server.

Add your local DB to your connection string config file.