Update: Microsoft will be moving away from UserVoice sites on a product-by-product basis throughout the 2021 calendar year. We will leverage 1st party solutions for customer feedback. Learn more here.

Bill Jetzer

My feedback

  1. 4 votes

    We're glad you're here

    Please sign in to leave feedback

    Signed in as (Sign out)

    We’ll send you updates on this idea

    10 comments  ·  SQL Server » Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    An error occurred while saving the comment
    Bill Jetzer commented  · 

    Huh. It's not even possible to write code to compensate for the behavior.

    Try something like this:

    ```
    If end of line = CR+LF then
    print everything to the left of the CR+LF
    print empty string
    else
    print the string
    ```

    And you'll realize that printing a _blank_ string actually prints a _space_! I verified that this is SQL Server behavior, not SSMS behavior, by printing a blank string in Azure Data Studio and noting the space in the output. Repro script below.

    ```
    print '----'; print ''; print rtrim(''); print left('',0); print null; print '----';
    ```

    There is a workaround for SSMS, but then you'll get extra blank lines in other tools:

    ```
    If end of line = CR+LF then
    print everything to the left of the CR+LF
    print CR+LF -- SSMS will print one blank line, all others will print 2 as expected
    else
    print the string
    ```

    An error occurred while saving the comment
    Bill Jetzer commented  · 

    I can confirm that it seems to be peculiar to SSMS. Both Azure Data Studio and DBeaver print the expected output.

    Bill Jetzer supported this idea  · 

Feedback and Knowledge Base