Display Line Numbers in SQL Server Query Window


You often see SQL Server code with or without line numbers. You might receive an error message when you try to add line numbers with SQL code. This behavior is by default and happens when we try to add line numbers manually. In this article, we look at how to enable line numbers in the SQL Server Query Window. 

Let us see how to enable or disable the display of line numbers in the SQL Server Query Window. The following defines some simple steps to do that.

Step 1. On the Tools menu, click "Options."


Step 2. When we click on the option, the Options window will be displayed:


Step 3. In the Options pop-up box, select "Text Editor" and expand it and select "Transact-SQL," expand it and select "General."


"Text Editor" -> "Transact-SQL" -> "General"


Step 4. In the General page's right-side panel, you must select the "Line numbers" check box under the "Display" section, as shown in the following image.


Step 5. Now click "OK" to save the changes and test them.



Step 6. Uncheck the check box of the line number that prevents the line number.


This article taught us how to enable line numbers in the SQL Server Query Window with code example.

Similar Articles