SSMS 2016 where have my line breaks gone?

categories: [ Data ] tags: [ SQL Server ] [ SSMS 2016 ]
created: 25 Jul 2016 @ 14:23 modified: 24 Apr 2017 @ 13:57

I’m hoping it’s not just me but one of the things I was missing from SSMS 2014 is that I had my line breaks when copying large text fields out of the query results. For a long time I have been putting it off and only using SSMS 2014, last week I re-installed my Operating System and decided not to install SSMS 2014 just for this 1 feature.

Today I queried that 1 large value again where I needed line breaks and got a very long string (or varchar for you db people Smile). I decided to go looking if they have made this into a setting before reverting back to SSMS 2014 like I have in the past and found there is actually a setting for this as you would expect Open-mouthed smile.

Retain CR/LF on copy or save

As mentioned there is a setting for this and it’s not as hard to find as most other settings Smile

Option 1 – Navigate the menu’s

Open Tools, Options

Ssms_2016-07-25_16-16-29

Navigate to Query Results, SQL Server, Results to Grid

ZoomIt64_2016-07-25_16-18-10

and on the right you will find a checkbox for Retain CR/LF on copy or save, switch that to checked and any future query windows will have you copying your text properly Smile.

Option 2 – Search

Open Tools, Options

Ssms_2016-07-25_16-16-29

Type Grid in the search box

Ssms_2016-07-25_16-20-57

and on the right you will find a checkbox for Retain CR/LF on copy or save, switch that to checked and any future query windows will have you copying your text properly Smile.

 

Hope this is useful for someone else as well. I find I usually fall back to what works instead of looking for the ‘right’ solution and if you look me that might be why you landed on this blog today Smile.