SQL Server: SSMS Tips- Enabling Line Number in the Query Window

Hi All

After reading Amit Bansal & AmitK’s tips about SSMS, thought of sharing the tip about enabling line numbers in SSMS query window.

In a day to day life many of you face the error message like this,

1_SQL_Server_SSMS_Tips_Enabling_Line_Number_in_the_Query_Window

From the error message it clearly indicates, error at line number 28. If you enable line number for the query window you can easily go to particular line number.

For SQL Server 2008:

In the SSMS go to Tools Menu-> Options. This brings up the below Options window & Select Text Editor from the Left hand side and traverse to “Transact-SQL” then enable the Line Number option from Display section and click OK.

2_SQL_Server_SSMS_Tips_Enabling_Line_Number_in_the_Query_Window

For SQL Server 2005:

In the SSMS go to Tools Menu -> Options. This brings up the below Options window & Select Text Editor from the Left hand side and traverse to “Plain Text” then enable the Line Number option from Display section and click OK.

   

3_SQL_Server_SSMS_Tips_Enabling_Line_Number_in_the_Query_Window

Now you can see the line numbers in the left hand side of your query window 🙂

4_SQL_Server_SSMS_Tips_Enabling_Line_Number_in_the_Query_Window

Another bonus tip…

You can use Ctrl + G to go to particular line number

5_SQL_Server_SSMS_Tips_Enabling_Line_Number_in_the_Query_Window

Thanks for reading & I hope this helps!

 

Regards

Meganathan Kanagaraj

Like us on FaceBook Follow us on Twitter

Join the fastest growing SQL Server group on FaceBook

   

5 Comments on “SQL Server: SSMS Tips- Enabling Line Number in the Query Window”

  1. Mega–>The other way to go to direct line No. is double click the error message it will take you to that line which causes the error..

  2. I was going to say DoubleClick on the error message, but Sumit beat me to it, I see! But this doesn’t always work – sometimes it takes you to the Select at the very beginning of the code, so I shall certainly be using Ctrl G

  3. slightly off topic however if possible really handy for readers.

    Do you know what the hot keys is to close the result grid once viewed results so one can continue tweaking their T-SQL?

Leave a Reply

Your email address will not be published.