Display Line Numbers in SQL Server Management Studio (SSMS)

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 Tools ⇒ Options as shown in the below snippet.

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 SSMS

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.

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.

Chetna Bhalla

Add comment


Newsletter Signup!

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Recent SQL Server Tips

Manning -->