Tuesday, July 21, 2020

Sample data on Azure using Northwind script

I got Northwind sample data in my local SQL servers, and they serve the purpose well, so I wanted to get them in Azure SQL DB.

When in need of a SQL DB, Azure is becoming a attractive solution. The basic instance costs NZD 7.55 as of today, and Standard is around NZD 22. Basic instance can store 2GB of data, hence  maintaining Azure DB in Basic and scale up and down as required is a practical solution for smaller data sizes. If you need more data, Standard gives 250GB. Though this is enough for most tasks, paying  NZD 250 per year could be too much if you are just playing around.

Northwind is created using a self-contained script - it does everything starting from creating the database and setting up the data locations for local servers. But naming the db as Northwind is not ideal for Azure if the database is already created by admins; setting up data locations are unnecessary in Azure world. I was expecting to do some changes to the script.

I already had the scripts downloaded  from Github at

https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs

When looked closely, almost no changes were necessary to run the script in Azure. Some settings are for older versions of SQL while others are the defaults anyway.



Once the database was created with the name I prefer, connected to Azure server using SQL Management Studio, started a new query form the database, pasted the script and just removed the lines up to "use Northwind" (including that) before executing.

It took a couple of minutes, but there were no errors. All the relations and stored procedures all were there. I executed a couple of stored procedures, they worked fine and think rest will work too.





No comments:

Post a Comment