Connect With

"Receive newsletters and special offers about SQL Server, BizTalk and SharePoint from MyTechMantra. We respect your privacy and you can unsubscribe at any time."

Display Line Numbers in SQL Server Management Studio (SSMS)

Nov 21, 2014


As a developer you may have often encounter errors while debugging TSQL code. SQL Server will show you an error message referencing you to a particular line number where the syntax error has occurred. This tip explains how to enable Line Number feature in SQL Server Management Studio (SSMS). The step mentioned in this tip is applicable to all versions of SQL Server Management Studio starting SQL Server 2005.

How to Display Line Numbers in SQL Server Management Studio (SSMS)

In SQL Server Management Studio (SSMS) by default display line number feature is disabled. However, you can easily enable this feature by following the steps mentioned in this tip.

1. Open SQL Server Management Studio. Click ToolsOptions as shown in the below snippet.

SQL Server Management Studio Tools Options To Change Settings

2. In the Options dialog box on the left side pane expand the Text Editor and then expand Transact-SQL. Select General option as shown in the below snippet.

Display Line Number in SQL Server Management Studio

3. In General Page, under Display select the Check Box next to Line Numbers as shown in the above snippet and click OK. Select “Word Wrap” option under Settings if you would like to wrap the TSQL code. Once you have enabled this feature in SSMS every time you open a New Query window it will Display Line Numbers.

SSMS Query Window Displays Line Numbers

Important Note: Whenever you encounter an error while running the TSQL Code you can double click the error message in the messages tab and SSMS takes you to the line which is wrongly written. 

"Did this article help you? Then Do Like Us on Facebook! And Signup for Our Newsletter"”

Next Steps

  • Recommend you to explore other features in SQL Server Management Studio.

Share this Article