Skip to content
Home » How to add line numbers in SQL Server Management Studio

How to add line numbers in SQL Server Management Studio

Most of the SQL Server DBA and developers use Microsoft SQL Server Management Studio (SSMS) to work with SQL Server databases. It is undoubtedly the most popular tool to manage SQL Server databases. SSMS comes up with many helpful tools and features. This article will enable a simple yet important option in the SSMS: adding line numbers in SQL Server management studio.

Line numbers may not always be needed in the SSMS, but it is quite helpful when debugging a large code or working with a complex script. When line numbers are enabled and visible, then you can directly go to that line number by typing it in the search area.

Steps to enable line numbers in SQL Server Management Studio

 To add row numbers in SQL Server management studio, follow the steps mentioned below.

  1. Open SQL Server management studio and Connect to SQL Server instance.
  2. Click on Tool from the main menu and then select Options as shown in the below screenshot.
Add line number in SQL Server management studio

3. The options window will pop up, Expand Text Editor on the left side and then expand All Languages.

4. Under the All Languages option, Click on General, and then on the right side, Check the box in front of line numbers and click the OK button to save the changes.

Add line number in SSMS

Now you will be able to see line numbers in the query editor as shown below.

Add line number in SSMS

Once you enable line numbers in SQL Server Management Studio, it is configured as a global option for all the query editors. You do not need to enable it separately for each new query editor. After the line numbers appear in SSMS, you can directly go to a particular line number, press Ctrl + G on the keyboard, and a small “Go to Line” window will appear, type the line number in it and click OK as shown in the below screenshot, it will take you to that line number.

Conclusion

In this article, we show you how to add row numbers in SQL Server Management Studio. It is a simple option to make line numbers appear in SSMS but it is very helpful when you are troubleshooting a large and complex script.

Recommended Read: