Displaying Line Numbers In SQL Query Editor

SQL Server management Studio(SSMS)) has option to provide functionality to enable or disable Line Numbers.

Often you see Query Editor in SQL without line numbers that make error finding tough, so use of line numbers is very useful in case of large module scripts.

Query Editor: You can see that the following Query editor is without Line Numbers.

Example:

1

Error Messages Example

Whenever you execute any Query if there is any error you will get notification as in the following,

2

In the above screenshot the error or warning occurred on Line no 29, now to remove or solve the error in script it may take lot of time to focus on the correct line identification as we don’t know the line number.

In lengthy scripts it’s tough to find error line quickly, to solve this issue it’s preferable to use Line Numbers indications.

Procedure to Enable/Disable Line Numbers: SQL Server Management Studio provides option to make line number view possible. Follow the below steps:

3


After clicking on Options, you need to click on Text Editor, then select Transact-SQL. In general tab options  lick on Display as Check/Uncheck to Line Numbers or you can follow the following image given indications:

4

Press OK Button to close it.

Now you can see the Query Editor with Line Numbers:

5

So, solving any error become efficient with the use of line numbers. If you do not want to view Line Numbers just Uncheck the line numbers check box option.

Up Next
    Ebook Download
    View all
    Learn
    View all