I had the honor of being part of the first Data Platform Discovery Day event, held over two days – one for US and one for Europe. This was a virtual event designed for those who are new to the Microsoft Data Platform. I was honored that they picked me to present my “Back to the Basics: T-SQL 101” session.
I decided this was the perfect opportunity to play around more with SQL Notebooks in Azure Data Studio (ADS). I didn’t give myself a lot of time to get ready – just a couple of days.
Formatting Text
When I have seen Notebooks before, one of the things that I really liked was that there was a text component to the layout. This means that I can write instructions and descriptions in text and not just in comment blocks.
In my scripts before, you would see something like this:
With Notebooks, I came up with this instead:
For a visual person like me, it’s a much nicer way to do this. But then you see the details behind the scenes for the text cells:
It’s using tags to create formatting! I recognize some of the tags from HTML but there are some non-HTML bits as well, like the use of asterisks to create the lines around the word SELECT in the header. It’s a minor detail but I really liked the visualization. I used the asterisks and lines to visually create sections in other parts of the scripts.
Since I was able to use some HTML formatting, I now wonder if I can use other HTML code in the formatting:
The result:
Images and colors in the text? I have a feeling that this, just like using SELECT * in production, may prove to be a bad idea.
I did some searching and found this site which has a great list of the markdowns for the text editor. And as I am putting this blog together, I see someone tweet about a markdown editor toolbar. Naturally, I stopped what I was doing, updated my Azure Data Studio, and find this now exists:

It may take a while for my “formatting magic” to kick in for this. I don’t want to get carried away with this so it will be a balance. But as my comments in presentations are also guidelines, directions, and pointers for the attendees who download the scripts later, I like the readability that the Text cells offer that you don’t always get by looking at green text that’s the same font and size as the rest of your code. And now that I know what I’m doing, I probably will go back and clean up the text boxes since I have more time and now understand what I’m doing.
Demo Mode
There’s also another really important detail about Azure Data Studio that makes me think that this really is designed for those who are presenting or sharing code with other people:
Demo Mode is an Extension you can hide or show on the status bar. You can find it if you right click on the bottom:
You can also change the settings for Demo Mode. Here I did a search in the settings:
Now I can see the difference when I enable demo mode. I just click on “Enable Demo Mode” on the scroll bar to Enable or Disable it. Hopefully you can see the differences in the images below. The one on the left is the original font size and the right is Demo Mode:
Code with Results
One of the cool things is being able to reference the result sets of code you already ran. With Management Studio, the results are a one-time thing that you have to save off. In the SQL Notebooks, the results are tied to the cell and stay there after you run the code.
For example, I have two queries that are similar but have small syntax changes that I use to show the difference. In Management Studio, I can show the queries side by side but I have to the run them together so the results can be compared at the same time:
But in SQL Notebooks, I can run the two queries separately and easily see which results go with which SQL. But I don’t have to run them at the same time to do this. Look at the last column, which shows the time the queries were run:
Some drawbacks
Nothing is perfect so I did run into some drawbacks and a couple of things I did have to get used to:
- I ended up having to transfer over my scripts by hand. It was more tedious than a true problem. But if you’re trying to transfer over something very complex, it will definitely be time consuming.
- I was hoping I could put everything into 1 single notebook that had different tabs for each of my demo sections. I think this may be a current limitation with SQL Notebooks but I’ll have to look into this more. So far, my searches have come up empty on this.
- I would like to adjust the spacing between the text and the comments. There’s a little too much spacing in some cases. It’s more of a visualization thing than a true issue.
- There is no option to only run the highlighted code in the cell – it’s an all or nothing deal. One of the things I like to do is highlight how you can test\create the SELECT statement version within your INSERT\UPDATE\DELETE statement. Having to type in comments first rather than just highlight and run is more of an inconvenience than a problem. I have seen this with another IDE for a different relational database, although I can’t remember which one right now, so the fact that I can’t do that here is nothing new. But it is something I’m used to doing so being able to run part of a cell would be a nice-to-have feature in the future.
There may be ways to work with these but I’ll have to do more research.
Take-aways
Overall, using Azure Data Studio and creating SQL Notebooks for my T-SQL 101 session worked really well. It gave me a cleaner and more robust way to present and share my code and comments.
The biggest take-away is that it really wasn’t a big transition to make. I actually had Management Studio set up just in case I started running into issues and needed to switch over quickly. But I didn’t need to use it at all.
It was also the perfect way for me to really learn about what ADS has to offer and how I can leverage it. I’m definitely looking forward to seeing if any of my other presentations can make the switch.
There’s a lot more to Azure Data Studio that I need to explore, even beyond Notebooks. But this was a big step in the right direction.
Great. Thanks. Now I have yet more reasons to learn about this topic. I’ll just add it to everything else on my list of things to learn!
Seriously, cool stuff!
LikeLiked by 1 person
I watched your presentation during during Data Platform Discovery Day, and I was very impressed with your presentation style. You reminded me of Erin Stellato as far as your presentation “persona” (which is a good thing). Anyway, the latest version of Azure Data Studio has the Markdown Toolbar for text cells that makes some of the formatting much quicker.
LikeLiked by 1 person
Awww…. Thanks so much!
I agree – the toolbar for formatting will definitely be quicker. Looking forward to playing with that more.
LikeLike