Display Line Numbers in SQL Server Query Window

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

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".

Tool-Menu-in-SQL-Server.jpg

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

Tool-Menu-with-option-in-SQL-Server.jpg

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

Or

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

Tool-Menu-with-Transact-SQL-option-in-SQL-Server.jpg

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

Line-number-in-SQL-Server.jpg

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

Line-number-test-in-SQL-Server.jpg

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

Up Next
    Ebook Download
    View all
    Learn
    View all