Display Line Numbers in SQL Server Query Editor Window
If you are a database users then you may have observed while executing any query when it gives error and error message shows that on particular line number there is some issue. So we need to go to particular line number and correct the same. But what if your code is hundreds or thousands of lines, in that case scrolling down and finding that error line becomes quite difficult and time consuming.
SQL Server Management Studio provides an option to display line numbers in query editor window. In SSMS you can go to Tools –> and select Options…
It will pop up Options window as given below. Now navigate to Text Editor on left side options and select Transect-SQL –> General and in Display part choose Line numbers and click OK button. Now when when you will open a new query editor window, you will observe line numbers in it.
But if you don’t want to set line numbers in SSMS for every query editor window so there is one more option to directly go to particular line number by pressing Ctrl+G. When you will press it, you will get a pop up Go To Line to enter line number.
Here you can enter line number and press OK and your cursor will directly go to particular line number and you can correct the error.
CLICK HERE to watch live practical.
Reference: Manzoor Siddiqui [www.SQLServerLog.com]