Line Numbers in SQL Server Management Studio

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

Gregory Larsen
Gregory Larsen
Gregory A. Larsen is a DBA at Washington State Department of Health (DOH). Greg is responsible for maintaining SQL Server and other database management software. Greg works with customers and developers to design and implement database changes, and solve database/application related problems. Greg builds homegrown solutions to simplify and streamline common database management tasks, such as capacity management.

Get the Free Newsletter!

Subscribe to Cloud Insider for top news, trends & analysis

Latest Articles