Have you ever met the following scenarios: 1) when you write a very complex ad-hoc query in SQL Server Management Studio (SSMS), you need to count the total columns that have been derived. 2) You even need to refer to the line that appears in the error message. If yes, you need to enable the option of showing line numbers in SSMS. In fact it is very simple. It can be done in a minute. You just need to know to click the right button. Be cautious that it is different for SQL Server 2008 (2008R2) and SQL Server 2012.
Solution
Step 1: In SSMS, select Tools tab then Options as shown below
Step 2: In Option Popup Windows, expand “Text Editor”
a. For SQL Server 2008 and SQL Server 2008R2, you need to choose “All Languages”. Under General page, check the box for Line Number.
b. For SQL Server 2012, you need to choose “Transact-SQL”. Under General page, check the box for Line Number.
Hope this tip will help you improve your coding efficiency. If you just want to jump to some specific line in SSMS quickly, you can use CTRL+G hot key.