While creating the function, I encountered an error and was unable to find the exact line. After several checks, I found the line number in SQL Server Management Studio. In this SQL Server tutorial, we will learn how to view line numbers in SQL Server Management Studio.
View Line Numbers in SQL Server Management Studio
SQL Server Management Studio is an important database management system developed by Microsoft (Multinational technology corporation located in the United States). It is a high-level development environment for configuring, managing, and administering SQL Server components.
Now, whenever we receive an error message from SQL Server, it refers to a certain line number in our query. However, finding the line number where the syntax mistake occurred is a little frustrating. So, to overcome these issues, we’ll look at how to enable the line number functionality in SQL Server Management Studio.
To view line numbers in SQL Server Management Studio, follow the below steps.
1. First, open the SQL Server Management Studio on your system. Then, select Tools from the menu bar and click on Options. This will open an Options dialog box.

2. On the Options dialog box, first, expand the Text Editor option from the left side panel then expand the Transact-SQL option. After this, click on the General option, and it will open the general tab on the right-side panel.
3. Now, from the right panel, move to the Settings section, and tick mark the Line numbers option. And then click on the OK button as shown in the screenshot below.

So, we have enabled the line numbers functionality in SQL Server Management Studio. To test the result, we can open a new or existing query editor page.

Video Tutorial
Disable View Line Numbers in SQL Server Management Studio
We can use the same steps to disable the line numbers functionality in SQL Server Management Studio now.
- First, select the Tools from the menu bar and click on Options.
- Next, expand the Text Editor and Transact-SQL option and click on the General tab.
- After this, under settings, uncheck the Line Numbers check box. Click OK.
Conclusion
So, in this tutorial, we have learned how to view line numbers in SQL Server Management Studio. Moreover, we have also covered how to disable the view line numbers in SQL Server Management Studio.
You may also like to read the following SQL Server tutorials.
I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.
Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.