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


By:   |   Updated: 2008-11-10   |   Comments (5)   |   Related: More > SQL Server Management Studio

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"

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.

word wrap

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

create procedure

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.

create procedure
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 Updated: 2008-11-10


get scripts

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





Comments For This Article




Saturday, February 10, 2018 - 2:38:52 AM - Dharmendra Kumar Pandit Back To Top (75172)

 

 Thank you. Its helpful


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

thankful for me....


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

This was very helpful


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

 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 (2185)

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



download


Recommended Reading

Display Line Numbers in a SQL Server Management Studio Query Window

SQL Server Management Studio Connection to Integration Services Error Class Not Registered

Connect to SQL Servers in another domain using Windows Authentication

Executing large scripts in SQL Server Management Studio with Insufficient Memory Failures

Different Options for Query Results in SQL Server Management Studio





get free sql tips
agree to terms


Learn more about SQL Server tools