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)

1 vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

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

    2 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...

      Feedback and Knowledge Base