问题
I have a table in which one column (type ntext) has data that includes carriage return and linefeeds. (CHAR(13) and CHAR(10)).
If I right click the table in SSMS 2008 and choose 'Select Top 1000 rows' and the display mode is set to "Result to Grid" it seems that control characters (like TAB and CRLF) are converted to spaces for display in the grid!!
Yet if I right click the table and choose 'Edit Top 200 rows', the control character data is shown in the resulting grid (as two small squares).
Is there any way to keep SSMS from stripping out the control characters and changing them to spaces? At first I thought that it was just a display issue but if I right click one cell and choose copy and then paste into notepad, only spaces are pasted.
I don't understand why they would do that.
回答1:
When you switch to "Results to Text" or "Results to file", special characters would be preserved. In grid, they are lost, unfortunately.
It wouldn't be hard to fix it, but someone has to open bug on http://connect.microsoft.com. Then there is a chance SSMS team will react and fix it.
Since I'm no longer on that team, that's the only thing I can suggest.
回答2:
This issue is fixed in SSMS2012. For SSMS2008 there are some add-ins that fix it.
来源:https://stackoverflow.com/questions/3612817/ssms-2008-converts-control-characters-to-spaces-when-using-results-to-grid