Importing Adventureworks using Azure Data Studio (via local SQL Server)
If you’re like me, and is tying to follow a tutorial about SQL which is using Adventureworks on Mac… or just simply wanna play with a good sample DB. Here’s a step by step guide on how to set it up.
- You will need Docker
- Install Azure Data Studio
- Download Adventureworks (any of the OLTP downloads would work)
Run SQL Server
- This is using this instruction - https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash
Pull SQL Server
sudo docker pull mcr.microsoft.com/mssql/server:2017-latest
Run SQL Server locally.
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=<[email protected]>" -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2017-latest
See running containers
You now have a SQL Server running locally
Connect to your SQL Server using Azure Data Studio
New Connectionor if you’ve used it before, under Connections, next to SERVERS, click the New Connection Icon
Fill it in:
- Server: localhost
- Username: sa
- Password: (what you put in [email protected]) above when you ran the docker container
- Download AdventureWorks2017.bak (or whatever year) from
Copy it over to your docker container
- Check your container ID and copy over your file into the mssql directory in the container.
In this case, my file saved in my
docker ps docker cp ~/Downloads/AdventureWorks2017.bak <containerID>:/var/opt/mssql/data/
- Check your container ID and copy over your file into the mssql directory in the container. In this case, my file saved in my
Back to Azure Data Studios, click on your localhost connection, and click Restore in the Dashboard
In General > Source. Select Restore from: Backup file. And in Backup file path, click (…)
You should be able to see AdventureWorks under data
You now should be able to see your AdventureWorks db under Databases. If not, right click on Databases and click “Refresh”.
You can click on the AdventureWorks DB and click New Query on the dashboard