Learn more about SQL Server tools

mssqltips logo
 

Tutorials          DBA          Dev          BI          Career          Categories          Webcasts          Whitepapers          Today's Tip          Join

Tutorials      DBA      Dev      BI      Categories      Webcasts

DBA    Dev    BI    Categories

 

Easier way to read your TSQL code in SSMS with word wrap feature


By:   |   Read Comments (4)   |   Related Tips: More > SQL Server Management Studio

New Whitepaper > 10 Ways We Can Steal Your Data >> download now


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


Last Update:


signup button

next tip button



About the author
MSSQLTips author Atif Shehzad Atif Shehzad is a passionate SQL Server DBA, technical reviewer and article author.

View all my tips
Related Resources





Post a comment or let the author know this tip helped.

All comments are reviewed, so stay on subject or we may delete your comment. Note: your email address is not published. Required fields are marked with an asterisk (*).

*Name    *Email    Notify for updates 


SQL tips:

*Enter Code refresh code     



Saturday, January 31, 2015 - 12:17:30 AM - Ritesh Kc Back To Top

thankful for me....


Wednesday, March 28, 2012 - 3:57:29 PM - Jay Back To Top

This was very helpful


Monday, November 10, 2008 - 11:36:37 PM - @tif Back To Top

 eliassal, i have tested for said problems through many scenarios. Fresh installation of SQL server without SP, with SP2, with SP3 and by reinstalling management tools after SP3. But i have found it Ok. Please tell the edition and sp of your SQL Server.

Regards


Monday, November 10, 2008 - 1:29:41 PM - eliassal Back To Top

Hi, I followed instructions but nothing is happening or changing in my query window which stills goes beyond the scroll bars and doesnt wrap.

 

Thansk for your time


Learn more about SQL Server tools