In SQL Server Management Studio, I've configured the Text Editor to show the line numbers, like so:

enter image description here

I want to move these into a word document for documentation. Right now if I were to highlight this piece of code, copy it, and paste it into word, I get this:

enter image description here

Is there an easy way for me to copy the contents, and preserve the line numbers?


No. But, you could put the content into a spreadsheet, have the first column enumerate the line numbers, and then paste this in your document.

The line numbers are not part of your content, they are part of the editor visualization features.


Notepad++ is an excellent program for doing this, however you may need to change the settings in order to show the line numbers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.