DEV Community

Cover image for The 'SELECT' Few: Enhancing SSMS with SQL Add-Ons and tweaks
Emmanuel Duchene
Emmanuel Duchene

Posted on • Edited on

The 'SELECT' Few: Enhancing SSMS with SQL Add-Ons and tweaks

So, the first programming course being over, we have now moved over from C# to SQL, leaving Visual Studio for SSMS. At least for a couple of weeks. I had not worked with databases before, at least not that way. I had mostly used database tables within cartography adn geodata analysis to retrieve and display data graphically but using a query builder and not real SQL queries.

I find it quite fun and relatively intuitive. Most often satisfying. SQL is not a difficult language per say but sometimes feels like it was made up by a programmer who kinda sucked and thought they could make it more natural to write, which, somehow, it is. I guess it feels that way because it's been around since the 1970s, which is, all in all, pretty impressive. This is all a joke, SQL is a powerful language that will let you filter and display anything you want.

I am enjoying it but some formatting conventions and best practices can be quite tedious and not very easy on your fingers, should you choose to follow them. For instance, capitalization of keywords. Of course, you're free to ignore them but I like to follow these conventions to make the code more readable and easier to understand. However, it kinda hurts after a while, having to hold shift for full words or expressions, or having to enable/disable caps all the time. Also, I'm lazy.

SQL Complete

I have spent quite some time researching possible settings, add-ons or tricks, and they are many, but mostly behing paywalls and some of them would have you sell a kidney on the darknet to be able to finance, especially as a poor student. But I am not easily defeated when it comes to be lazy, si I persevered and found dbForge's SQL Complete add-on for SSMS, which lets you tweak the formatting of your SQL code. You can for example choose to automatically enclose identifiers within square brackets (and even choose conditions for this). You can also use existing formatting profiles, provided by SQL Complete or use them as templates to create your own formatting profile, saved as an xml document om your machine, should you want to use it across different machines. Within these profile, you are able to edit any formatting for any command (tabs, line breaks before and after, size of tabs, etc.). The possibilities are pretty much infinite. Not actually, but I swear you'll find what you need.

Screenshot of formatting profile

Oh and I almost forgot, you can even ask it to format whole folders with .sql files on your computer. I know...

What more to ask? Well, on top of that, it's free. The Express version of SQL Complete is completely free. Upon download and set up, you'll get a Trial of their premium version first and it will downgrade to Express when the trial expires. You will lose some functionality after that but most of the formating settings will remain. Even if for a couple of weeks, it is very worth the try.
You can get it here.

Use your favorite VS Code theme in SSMS

This great Github repository by Tim Cartwright will take you through the steps of customizing your SSMS theme, because let's face it, the default theme is very bad, both for the eyes and the soul. It is very surprising that Microsoft hasn't made it possible to customize it or implemented a real dark mode into SSMS.

You can follow the instructions on this repo to the letter or you can mix them with a few other processes to get SSMS to look exactly like you want, which I did.

My all time favorite VS Code theme is Monokai Drake and I use it for absolutely everything, VS Code, Visual Studio, Obsidian and now SSMS. To get any VS Code theme to work in SSMS, you need to convert it into a .pkgdef. Easy, right? Well, actually not so hard thanks to this tutorial. Follow the instructions: start by creating the theme's .JSON file and then go back to Using the tool. At step 6, choose the second option. If you want to use your favorite theme in Visual Studio too, keep following the instructions on how to create a .vsix file.

Once you have the .pkgdef file, go back to the VS Color Themes tutorial and follow the instructions to install the theme manually. Basically, go to wherever SSMS is installed on your computer, by default C:\Program Files (x86)\Microsoft SQL Server Management Studio 19\Common7\IDE\Extensions, create a VSColorThemes folder and paste the .pkgdef file you created earlier. Launch SSMS and change the theme. Voilà! Note that the Object Explorer and Results window will remain white and you'll have to live with it.
Mine looks like this:

SSMS with custom theme

SQL Shades

If you can't live with it, forget using a custom theme and use SQL Shades instead. The colors are not customizable in its current version, but the whole program will be in dark mode. Of course, it's free!

That's all for now, hope your SQL life will be smoother with these tips!

Top comments (0)