SQL Server Articles, SQL Server Tips, SQL Server Tutorials, SQL Server Tuning, SQL Server DBA, SQL Server Basics, Training, etc - MyTechMantra.com

Display Line Numbers in SQL Server Management Studio (SSMS)

SSMS Show Line Numbers | SSMS Line Numbers

This article explains how to enable SSMS show line numbers.

SHOW Line Numbers in SQL Server Management Studio

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 Show 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.

Follow the simple steps mentioned in this article on How to Show Line Numbers in SQL Server Management Studio

Developers often encounters error in TSQL Code during development and this tip helps to Show Line Numbers in SQL Server or SSMS Show Line Numbers.

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.

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 SSMS

SSMS Show Line Numbers

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. This way to can enable SSMS Show Line Numbers Feature. 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. 


I recommend enable SSMS Show Line Numbers feature in SQL Server Management Studio as it helps to quickly move to the TSQL Code which is breaking.

“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


Chetna Bhalla, the founder of MyTechMantra.com, believes that by sharing knowledge and building communities, we can make this world a better place to live in. Chetna is a Graduate in Social Sciences and a Masters in Human Resources and International Business. She is an alumnus of Vignana Jyothi Institute of Management, Hyderabad, India. After graduation, Chetna founded this website, which has since then become quite a favorite in the tech world. Her vision is to make this website the favorite place for seeking information on Databases and other Information Technology areas. She believes that companies which can organize and deploy their data to frame strategies are going to have a competitive edge over others. Her interest areas include Microsoft SQL Server and overall Database Management. Apart from her work, Chetna enjoys spending time with her friends, painting, gardening, playing the violin, and spending time with her son.

Newsletter Signup! Join 15,000+ Professionals

Be Social! Like & Follow Us

Follow us

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