CR, LF, and Copy-paste in SSMS Query Results

Fun tidbit from a co-worker this week, very helpful if you’re not exporting right to Excel from the results context menu.

In SSMS:
Under Tools > Options

  1. Expand Query Results > SQL Server > Results to Grid
  2. Tick Retain CR/LF on copy or save
  3. Restart SSMS

This will cause CR, LF, and CRLF to be treated as newlines when you copy a cell.

2 thoughts on “CR, LF, and Copy-paste in SSMS Query Results

  1. Thank you! But will it do it for pasting?

    I mean pasting into a cell when editing a table or view or query?

    1. That’s a good question! So far I can’t successfully copy-paste a return line character into the editor for SSMS. I’ll keep looking into this and get back to you.

Leave a Reply to daveboltman Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.