How to add Line Numbers in SQL Server Management Studio ( SSMS) - SQL Server / TSQL Tutorial Part 11

Scenario:

As sql server developer we write a lot of scripts and every time error occur, it say error happened on line number x.

if you are using 3 lines code like me, you might be Ok to see which is third line :) but if your have 100,s of lines of code, it is good idea if you can see the line numbers next to code.  Question is, How to enable line Numbers and if I will copy this script, will line numbers will be copied as well?

Solution:

Open SQL Server Management Studio(SSMS). Go to Tools and then Options as shown below.
How to add line numbers in SSMS - SQL Server Tutorial

Now go to Text Editor, Then Transact-SQL and hit General. On Option windows check the Line Number Box under Display as shown below.

How to Add Line Numbers to SQL Script in SSMS - SQL Server Tutorial


Now you should see the Line Numbers next to your script, and If you will copy the script , it will not copy the line numbers with it. Line Numbers are there only for display.

Add line numbers to sql script in SSMS - SQL Server / T SQL Tutorial





3 comments:

  1. I have learnt various good stuff right here, and I’m sure everyone will get advantage of it.
    top rated web designs

    ReplyDelete
  2. Building an Access information base typically begins with chipping away at the tables first and getting the right sorts of informational index in your application from the beginning saving you a ton of time and cerebral pains later when computing and alluding to numeric qualities somewhere else.number information

    ReplyDelete
  3. In case you are simply intrigued on the traffic from a predefined country, you control that. traffic management plans

    ReplyDelete