I have below code:-
DECLARE @NewLineChar AS CHAR(23) = CHAR(13) + CHAR(10)
select \'abc\'+@NewLineChar+\'a\'
I expect the result to be:-
<
It will work. But you have to see the result in Result to text
output
select 'abc'+ CHAR(13) +'a'
When using the results to grid option, SSMS use the standard Windows grid control to display the results. This grid control treats each cell value as a plain text and hence the new line characters are ignored.
However if you use the results to text option or the results to file the new line characters are retained.
Refer : https://connect.microsoft.com/SQLServer/feedback/details/381955/sql-server-management-studio-should-show-new-lines-in-records
Enable Result to text
by pressing ctrl + t
then run