11/13/2017 michelemayaw@gmail.com

Writing SQL Queries: Display Line Numbers


Whether you are a beginner or experienced writing queries you may receive an error message when you execute a query. 

SQL identifies errors within a query by line number. Instead of counting through each line it is much more efficient to use the Line numbers option.


TOOLS: Microsoft SQL Server Management Studio v17.2

TASK: Select Line numbers option.

SOLUTION:

Using SQL Server Management Studio from the menu bar select Tools then Options from the dropdown menu.

image

The Options window will pop-up. Select Text Editor then Transact-SQL. Under settings check the box by Line numbers. Finish by selecting OK.

image

You will be able to view line numbers listed to the left of each line of the query in the test editor window. These will correspond with any numbers listed under messages in the query results window.

image

An unhandled error has occurred. Reload 🗙