Thursday, February 14, 2013 6:17 PM
I'm creating a catalog of common queries I use, and want to paste the code into a Word Document. Is there a way of copying the line numbers along with the code?
I could create an elaborate numbering scheme in Word, but don't really want to :)
- Edited by cvermette Thursday, February 14, 2013 6:19 PM
Thursday, February 14, 2013 6:48 PMModerator
Unfortunately there is not. You can include column headers, but there is no option to include the line numbers
Hope this helps
David Dye My Blog
Thursday, February 14, 2013 6:56 PM
Adding Line Numbers in word isn't too bad, check this link:
Perhaps a better alternative would be to list your queries & comments within a .SQL file instead of a word document?
Edit: Just noticed the link is for 2003, either way you can add line numbers from the "Page Layout" section.
Zach Stagers - scratchbox.co.uk
MCITP: Database Developer 2008
Remember to Mark as Answer and Vote as Helpful
Thursday, February 14, 2013 7:00 PMModerator
It is annoying when you copy query code from webpage with the line number. Since you want the line number with your code, you can try to post your code in a Wordpress blog page with code block in this format:
--Your code goes here.
When you view your page, you will see the line numbers along with your code. You can copy the code directly from the page block, you will have both code and line number if you paste it to Word.
If you want to remove the line number, you can use view source tab from the block header part to copy code. I don't know whether this offer you an option.
- Marked As Answer by cvermette Thursday, February 14, 2013 7:54 PM
Thursday, February 14, 2013 7:57 PM
Thank you Jingyang. You are right that the line numerbs are an annoyance if you want to paste the code in SQL Server (Which is what I want the reader to do). So I think I'll abandon the idea of line numbers. Thanks again.
Thursday, February 14, 2013 8:11 PMThnaks David, that was my suspicion. thanks to some other folks who answered I think I came up with a better solution. You did save me from a dead end, and that's a big help!
Thursday, February 14, 2013 8:15 PMZach I thought of that. The problem is that when you restar the line numbers at 1 Word adds a start and end page break to teh selection or section. A solution in some circumstances (and one I'll keep my my toolbox, but not viable for what I'm doing (but see below - you did give me a solution!)
- Edited by cvermette Thursday, February 14, 2013 8:16 PM
Thursday, February 14, 2013 8:20 PM
Zach it looks like I accidentally deleted another response you gave, which I decided was my solution: jsut use a SQL project file
My orignal thought was that I wanted a catalog format with a TOC or index describing what queries were available. I can do that as follows: I Create a project file with all of the queries, and put addiitonal comment in the code (Something we shoud all do anyway...). Then, put all the queries in a project file, giving then clear, descriptive names. Lastly, I create a query called "Read me First" which is just one long comment with an index of the catalog.
Thursday, February 14, 2013 8:25 PM
and I was wrong about line numbers! You can supress them for paragraphs/selections and they resequence:
- Edited by cvermette Thursday, February 14, 2013 8:25 PM