Shortcut: Using visual glyphs in SQL Server Management Studio query editing

Code quality has always been an important topic ever since coding began.

Code complexity is an important part of this. One of the topics that came up many years ago was a discussion on what length procedures or functions should be, before they became too difficult to follow.

I remember one guy commenting that he thought as soon as all the code didn’t fit on your screen any more, you were much more likely to have bugs in it. At the time, screens weren’t all that big.

It’s an interesting thought but even today when writing T-SQL though, if you’ve ever worked on a 4000-line stored procedure, you’ll know how hard that is. If you must work on a long script, it makes it even harder if it’s also a wide script. Then you end up scrolling around in both directions. For this reason, most formatting tools like SQL Prompt have an option to limit the width of lines.

Breaking code into separate lines however, isn’t always possible. And if you’ve decided that you really don’t want to do that, you can enable word wrap in SQL Server Management Studio (SSMS).

One challenge with this is that it’s hard to work out at a glance, which lines have been wrapped and which haven’t.

The answer to this is to enable a visual glyph for the word wrap.

From the Tools menu, choose Options, then Text Editor, then All Languages, then General. Note the option for showing the glyphs:

Now when the word wrap occurs, you can see it quite clearly:

Leave a Reply

Your email address will not be published. Required fields are marked *