Today I walked through the Use Azure Data Studio to connect and query Azure SQL database Quickstart. This Quickstart is solid and is great for someone new to Azure Data Studio.
At the end of the Quickstart it suggested I try the Tutorial: Use the Transact-SQL editor to create database objects - Azure Data Studio. The tutorial taught me a couple of things that I’ve not noticed about Azure Data Studio, even though I’ve used it for a couple of years.
Built-in snippets are quite useful
I had no idea that Azure Data Studio had built in snippet functionality. And I admit that as soon as I skimmed the tutorial and saw there were snippets, I tried to use them the wrong way. I assumed that I’d open the Command Palette to insert a snippet. Nope!
To access snippets, simply type sql into the query editor itself. This will initialize a drop-down list which you can arrow through:
You can create your own snippets
There are built-in snippets for lots of things – data definition changes like creating indexes or adding columns, data modification tasks like inserting or deleting rows, or management tasks like listing databases or finding space used.
But you might want to create your own snippets, too.
‘Peek definition’ functionality exists, too
I also hadn’t realized that Azure Data Studio supports Peek Definition functionality natively. The example given in a tutorial of peeking at a table’s definition when writing an insert statement is right on.
Bonus: Dragging the Columns folder into a query edit works just like in SSMS
Stepping through the Peek Definition example made me wonder if one of my favorite lazy hacks from SQL Server Management Studio works in Azure Data Studio. Sure enough, it does! You can write out the list of columns in a table in your query editor by dragging the column folder for the table into the query editor window:
Azure Data Studio isn’t just for Azure SQL
Don’t let the name fool ya. Azure Data Studio works for both Azure SQL and on-prem SQL Server installations.