You are here:   Blog
Register   |  Login

Blog Archive:

* Can be used in order to search for older blogs Entries

Search in blogs

Blog Categories:

* Can be used in order to search for blogs Entries by Categories

Blog Tags:

* Can be used in order to search for blogs by keywords


Awared MVP


Microsoft® Community Contributor 

Microsoft® Community Contributor

 Read this before you use the blog! Maximize

Recent Entries


Written by: ronen ariely
22/09/2021 12:28 RssIcon


Line breaking, also known as word wrapping, is breaking the displayed of a section of text into lines so that the text will fit into the available width of the editor. When writing queries this feature is not so useful as breaking the script line may make the query less readable, but when writing long comments this feature become one of the most useful feature. 

This post simply shows you how to use word-wrap by default or add a command button to Toggle Word Wrap - it's a built-in feature which is less known and if you did not used it yet, then it is time to use the power of word wrap

Configure SQL Server Management Studio to use Word-Wrap by default

Click on "Tools" and open "Options"

Move to the: "Text Editor" -> "All Languages" -> "General"

Mark the option "Word wrap"

Click "OK" and you are ready

The problem with this approach is that this will wrap anything in the editor windows including the scripts -> this might be something that we will not want. We do not want to configure the SSMS each time that we want to read a long comment and configure it back not to use word-wrap when we want to read/write script.

The solution is to add a toggle button for the task...


Add Toggle Word Wrap button

Right click on the buttons tab and click on "Customize..."

Move to the "Commands" tab

Select the location of the new button: In bellow sample we add the button to the "Menu bar"

select "Menu bar" -> select "Edit"

Note! You can add the button to any existing menu or as new menu as well. In my specific case, I add the button to existing menu "ariely.info", which is an extension that I developed for the SSMS. You can notice that I added it as a new group (you can see the line between the groups of buttons). You will probably want to add it to the menu bar as shown in the above image.

Once you select the location for the button, Click on the "Add Command"

Find the command "Toggle Word Wrap"

and click "OK"

If you want to move the button to the end of the tools bar or any other location, then you can right click on the menu bar -> find the button where you added it -> use the buttons "Move Up" and "Move down" to put it in the right location

I hope that this was useful