Formatting issue with COALESCE

If I have a COALESCE with a lot of columns in it, it is kept in one row. Even, if the row is longer than the defined wrapping length ("Wrapping lines longer than 120 characters").
Would it be possible to also do a wrapping for the COALESCE()?

Thanks,
Tagged:

Comments

  • Hi @ThoschVX,

    Thanks for reporting this. Can you please provide us with a quick example of a COALESCE statement, and how you would like to format it?

    Best regards,
    Krzysztof
  • Hi @krzysztofkroczak I would like to have it like this:
    COALESCE(
             ns.com_all_A0
            , ns.com_all_A1
            , ns.com_all_A2
            , ns.com_all_A3
            , ns.com_all_A4
            , ns.com_all_A5
            , ns.com_lastyear_A0
            , ns.com_lastyear_A1
            , ns.com_lastyear_A2
            , ns.com_lastyear_A3
            , ns.com_lastyear_A4
            , ns.com_lastyear_A5
            , ns.com_lastmonth_A0
            , ns.com_lastmonth_A1
            , ns.com_lastmonth_A2
            , ns.com_lastmonth_A3
            , ns.com_lastmonth_A4
            , ns.com_lastmonth_A5
            , ns.com_lastweek_A0
            , ns.com_lastweek_A1
            , ns.com_lastweek_A2
            , ns.com_lastweek_A3
            , ns.com_lastweek_A4
            , ns.com_lastweek_A5
            , ns.com_lastday_A0
            , ns.com_lastday_A1
            , ns.com_lastday_A2
            , ns.com_lastday_A3
            , ns.com_lastday_A4
            , ns.com_lastday_A5
    
    currently I get it like this after formating:
    COALESCE(ns.com_all_A0, ns.com_all_A1, ns.com_all_A2, ns.com_all_A3, ns.com_all_A4, ns.com_all_A5, ns.com_lastyear_A0, ns.com_lastyear_A1, ns.com_lastyear_A2, ns.com_lastyear_A3, ns.com_lastyear_A4, ns.com_lastyear_A5, ns.com_lastmonth_A0, ns.com_lastmonth_A1, ns.com_lastmonth_A2, ns.com_lastmonth_A3, ns.com_lastmonth_A4, ns.com_lastmonth_A5, ns.com_lastweek_A0, ns.com_lastweek_A1, ns.com_lastweek_A2, ns.com_lastweek_A3, ns.com_lastweek_A4, ns.com_lastweek_A5, ns.com_lastday_A0, ns.com_lastday_A1, ns.com_lastday_A2, ns.com_lastday_A3, ns.com_lastday_A4, ns.com_lastday_A5)
    

    Thanks,



  • Hi @ThoschVX,

    Thanks for sending us your SQL example. We think the `COALESCE` statement should obey the same rules as functions but isn't currently. I have logged a bug under reference SP-6598 to investigate further. We will get back to you if we find a fix.

    Thanks,
    Michael
    Michael Clark
    Technical Lead, SQL Monitor
Sign In or Register to comment.