Adding Line Numbers to SQL Server Management Studio

Have you ever had to maintain large stored procedures? Have you ever created complicated views or joins? Does the following error message ring any bell?

Msq 2812, Level 16, State 62, Line 753

“But where the hell is the line 753? Why isn’t my SQL Server Management Studio showing me the line numbers?”; you ask yourself. They are not shown by default, but you can enable them in the query editor.

Go to Tools -> Options -> Text Editor -> All Languages and tick Line Numbers under the Display section.

Enable line numbers in options.

And that’s it. You should see the line numbers inside your query editor.

Line numbers added to SSMS.

By the way, the same trick works for Visual Studio as well. In fact, SQL Server Management Studio has been built on top of it, so lots of tricks from Visual Studio works here too.

One last tip, you can use CTRL + G to go to the particular line. This shortcut allows you to navigate much faster and it works in lots of different text editors on Windows.

Would you like to get the most interesting content about C# every Monday?
Sign up to C# Digest and stay up to date!