Blog

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.

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

Tags: SQL
Categories:

2 comment(s) so far...


Gravatar

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
Gravatar

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

Search

Categories

Recent Posts

Writing SQL Queries: Display Line Numbers
Welcome To My Blog