Do you have a comment or suggestion to improve SQL Server? We’d love to hear it!

SSMS ignores final \r\n / CRLF / Carriage Return + Line Feed in PRINT and RAISERROR

In SSMS, when using PRINT and/or RAISERROR to display messages in the "Messages" tab, if the final two characters on the line are the Carriage Return, Line Feed combination (i.e. "\r\n" or "CHAR(13) + CHAR(10)" or "CHAR(0x0D) + CHAR(0x0A)" ) then they are ignored (or "eaten") and no newline is issued as expected. BUT, if either Carriage Return OR Line Feed individually are used, then a newline is issued as expected. This is inconsistent and it should be that the Carriage Return + Line Feed combination is not ignored at the end of a line being printed.

Other forms of white-space (i.e. space and tab) are likewise not ignore. It is only Carriage Return + Line Feed, and only when used in combination.

This behavior seems to only happen in SSMS. I have also tested using SQLCMD and capturing messages in a C# application and both of those register the newline at the end of the line as expected.

I have tested with SSMS versions:
* v17.1 (14.0.17119.0)
* 2014 (12.0.5203.0)

2 votes
Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)

We’ll send you updates on this idea

AdminMicrosoft SQL Server (Product Manager, Microsoft Azure) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

5 comments

Sign in
(thinking…)
Sign in with: Microsoft
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base