Problem
While creating T-SQL scripts with lengthy T-SQL lines you have one of two options; either use the horizontal scroll bar or create line breaks at various points to make the line readable without having to use the scroll bar. Scrolling or having to break the lines of code takes time away from paying attention to coding. It would be nice if there was a word wrap option or something similar. Are there are any options in SQL Server Management Studio to handle word wrap?
Solution
Line many new features in SQL Server Management Studio (SSMS), Microsoft has also addressed the word wrap issue. You can easily turn on this feature for the SSMS query pane, just follow the steps below to turn on this feature..
From the SSMS menus select “Tools” and then “Options”

In the “Options” window select “All Languages” on the left side. On the right side under Settings there is a “Word wrap” option which is unchecked by default as shown below.

Check the check box for “Word wrap” and this will enable word wrap for your query pane. Another option under word wrap is “Show visual glyphs for word wrap” this option if checked places a visual mark for each line where the word wrap is applied.

Without either option enabled the below image shows what is displayed in SSMS.

After turning on both options (“Word wrap” and “Show visual glyphs for word wrap”) your long query lines are displayed as follows. The highlighted characters below show the “visual glyphs” where the word wrap has been applied.

Next Steps
- With the word wrap option turned on you can focus more on your coding, logic and flow of your T-SQL script without having to scroll. So turn it on along with visual glyphs and get rid of scrolling and having to create manual line breaks.
- There are two other options under “Text Editor” where you can also apply this feature. If you select “All Languages” and turn on these features this will also apply to these two features as well.
- “Plain Text” – this applies to other documents such as text documents
- “XML” – this applies to XML documents

Atif Shehzad is a passionate DBA currently serving at Pakistan Revenue Automation Limited (PRAL). His main areas of interest are SQL Server database design, best practices, performance optimization, security/permissions and Reporting Services. He blogs his SQL Server notes on DBDigger. Find him on Twitter and LinkedIn.
- MSSQLTips Awards: Trendsetter (25+ tips) – 2013

It is good solution, but I prefer the option of adding “toggle word wrap” button and not change the editor default. There is no reason to change the default behavior for the editor – This might make some script much harder to read: https://ariely.info/Blog/tabid/83/EntryId/299/SSMS-tips-word-wrap.aspx