SHARE
Facebook X Pinterest WhatsApp

Line Numbers in SQL Server Management Studio

Written By
thumbnail
Gregory Larsen
Gregory Larsen
Sep 4, 2018

Have ever tried to debug a chunk of TSQL code (like a stored procedure) and found yourself trying to figure out which TSQL statement is at a particular line number?  By default, SQL Server Management Studio (SSMS) doesn’t display numbers.  But that is only the default, you can change it.

To allow your Query window to display line numbers all you need to do is go to the “Tools” item on the menu and then click on the “Options…” item:

Tools/Options
Tools/Options

When you do that the “Options” screen will be displayed.  On this screen expand the “Text Editor” item, the “All Languages” item, then the “General” item.  Under the “Settings” item enable the line numbers, by checking the “Line numbers” item.  To save this setting click on the “OK” button.

Options Screen
Options Screen

By doing the above you will now get line numbers in all of your query windows that are open, or any  new query windows that you might open. 

See all articles by Greg Larsen

Recommended for you...

Best Certifications for Database Administrators
Ronnie Payne
Oct 14, 2022
Become More Efficient at Writing TSQL by Creating Code Snippets
Gregory Larsen
Jun 30, 2021
Couchbase Raises $60 Million to Fuel NoSQL Database Efforts
Sean Kerner
Jun 30, 2014
MongoDB 2.6 Improves Open-Source Database Performance
Sean Kerner
Apr 8, 2014
Database Journal Logo

DatabaseJournal.com publishes relevant, up-to-date and pragmatic articles on the use of database hardware and management tools and serves as a forum for professional knowledge about proprietary, open source and cloud-based databases--foundational technology for all IT systems. We publish insightful articles about new products, best practices and trends; readers help each other out on various database questions and problems. Database management systems (DBMS) and database security processes are also key areas of focus at DatabaseJournal.com.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.