Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.
Recently I was looking through the forums and someone had a question on JSON and the Express edition of SQL Server 2019. I was sure JSON worked, but I also didn’t have Express set up on my machine. I decided a container would be a quick way to test this.
I’ve started lots of containers, but I rarely do anything other than the Developer edition. I know you can set the edition, but didn’t know how, so I had to look it up. This post covers the quick way to do this.
There are a lot of environment variables that we can use to configure containers, and SQL Server in particular. There are two that are required:
- SA_PASSWORD (or MSSQL_SA_PASSWORD)
These two need to be supplied to start the container. Beyond that, you can add others that are useful for you.
To run as Express, you will want to MSSQL_PID variable, which can be set to any of these:
- A product key
For my situation, this means I run Express like this:
docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=password" -e "MSSQL_PID=Express" -p 51433:1433 --name express2019 -h express2019 -d mcr.microsoft.com/mssql/server:2019-CU7-ubuntu-16.04
This starts up a new container, and I can connect, where I’ll see the correct version.
It took me about 5 minutes to get this working, and then it was a question of writing this post and capturing an image. I had the code, because I’d just used it.
Overall, a good way to show a few things about containers and SQL Server, and a skill that an interviewer might ask about.