Tuesday, September 29, 2020

Installing the Northwind Sample Database on your SQL Server Instance

 This post shows how to run a SQL Server Instance on about any computer using Docker Containers. Your next step might be to get a sample database into that SQL Server Instance. 

Thanks to Microsoft, you can get their sample databases as T-SQL scripts. You can use these to install these databases on whatever server you are connected to, including your "containerized" SQL Server instance.

Let's do the Northwind database. We'll use Azure Data Studio, since it works on Win/Linux/Mac.

Here are the steps:

  1. Click on this link, which will open up the text of the instnwnd.sql file.
  2. Copy all that code - I used ctrl-a to select it all, then ctrl-c to copy all of that into the clipboard.
  3. Open up Azure Data Studio (ADS)
  4. Right-click on your database server, and choose New Query
  5. Paste all the code into the query window - I used ctrl-v to do the paste from the clipboard
  6. Now click Run

The image above shows my docker container instance running on localhost port 1401, which is mapped to my docker container's localhost port 1433 (as explained in the prior post.)

Depending on your machine, this may take several minutes to run, and will give many output messages. Depending on the version of SQL Server that you are running, you are likely to get a few harmless error messages and warnings like "Tokenization is skipped for long lines ...".

Now right-click on your Databases folder and choose Refresh to see the Northwind database, with all its data.

You can do this same procedure with any of the sample databases available here


1 comment:

  1. Thanks for doing this, but... I am a Mac user. The Docker Sql/Server is fine, but I don't have ADS, just the command line. When I paste the T/SQL, it stops about line 790... suggestions?

    ReplyDelete

Followers