Writing SQL Queries: Display Line Numbers

Nov 12

Written by:
11/12/2017 10:19 PM  RssIcon

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.


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


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


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.


Tags: SQL

2 comment(s) so far...


Re: Writing SQL Queries: Display Line Numbers

Great tip - Beyond the itself, it's always useful to get help in navigating Microsoft's maze of settings. And I like the way you have the page laid out with Tools, Task, Solution. You have a great mentor by the way.

By RIchard Waddell on   11/20/2017 6:45 AM

Re: Writing SQL Queries: Display Line Numbers

Richard - Thank you very much for your words of encouragement. I hope to continue to build positively on this first effort. I agree, I am very fortunate to have a great, knowledgeable mentor. :-)

By Michele Washington on   11/20/2017 7:08 PM



Recent Posts

Writing SQL Queries: Display Line Numbers
Welcome To My Blog