Display line numbers in SQL Server Management Studio

When you are editing in SQL Server Management Studio, it would be beneficial to display line numbers in SQL Server Management Studio, especially if you are working on a large module.

You can download SQL Server from this link.

Common Problem:

We often encounter an error message from SQL Server, which points to a particular line number within our SQL query code. It is a little frustrating to find the line number where the syntax error has occurred. In this tip, we will look at how to quickly enable line the numbers feature in SQL Server Management Studio.


To display line numbers in SQL Server Management Studio, follow below steps:

Step1: Open SQL Server Management Studio. Navigate to Tools -> Options from the drop-down menu, as shown in the image below. Choose Options from the menu.

Toolbar Option for line numbers

Step2: In the Options dialog box on the left side panel, expand options until you can navigate to Text Editor, then expand Transact-SQL. Next, choose General, as shown in the image below.

SSMS Tools line numbers option

Step 3: After you click on General. Find the Display option from the right panel. Then check the “Line Numbers” checkbox under Display. Click on “OK”

Line Numbers Option

To apply Changes from the settings that we change, relaunch your SQL Server Management Studio and create a new query to see if the changes have been applied. Your SSMS Editor should now look like the image shown below.

SSMS Query Editor window with line numbers

That’s it! Hope this helps!

For related SQL Server topic you might want to check this article. Create a Stored Procedure in SQL Server.

Leave a Comment

%d bloggers like this: