Line Break / Bug

Hi Regate Team,

I did not find any solution to ensure the line break will look like this

before
[code]
SELECT
    shipperid, YEAR(shippeddate) AS shipyear, COUNT(*) AS numorders
FROM
    Sales.Orders
GROUP BY
    GROUPING SETS((shipperid, YEAR(shippeddate)), (shipperid), (YEAR(
                                                                    shippeddate
                                                                    )), ());
[/code]

after
[code]
SELECT
    shipperid, YEAR(shippeddate) AS shipyear, COUNT(*) AS numorders
FROM
    Sales.Orders
GROUP BY
    GROUPING SETS((shipperid, YEAR(shippeddate)), (shipperid),
    (YEAR(shippeddate)), ());
[/code]

It seems that the general! issue is that the line break will not work correctly when the setting Wrap lines long than (80) characters. It is not the expected behavior because after the line break the code has again 80 (in my example) characters to place the remaining code.

It would be nice to see a fix - thanks!

Torsten


Answers

  • edited May 12, 2019 9:27AM
    Another good example is the formatting of the following code

    SELECT
        CustomerKey
      , YEAR(OrderDate) AS OrderYear
      , SalesAmount
      , LEAD(SalesAmount, 1, 0) OVER (PARTITION BY CustomerKey
                                      ORDER BY
                                          YEAR(OrderDate)
                                     )
    FROM
        FactInternetSales
    WHERE
        SalesTerritoryKey = 1
        AND YEAR(OrderDate) = 2014;

    it should look something like this

    SELECT
    CustomerKey
      , YEAR(OrderDate) AS OrderYear
      , SalesAmount
      , LEAD(SalesAmount, 1, 0) OVER 
    (
    PARTITION BY CustomerKey ORDER BY YEAR(OrderDate)
    )
    FROM
    FactInternetSales
    WHERE
    SalesTerritoryKey = 1
    AND YEAR(OrderDate) = 2014;

  • @torsten.strauss

    Can you share your format style file with us?
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
  • Hi Tianjiao,

    thanks for looking into this!

    Please find attached the style.

    Torsten
  • Hi @torsten.strauss

    Thanks for your patience!

    The development team has triaged this issue. We accept this isn't right, but there are more impact issues we are currently working on so I'm afraid this behaviour won't get changed any time soon.

    We apologize for the inconvenience caused.
    Kind regards

    Tianjiao Li | Redgate Software
    Have you visited our Help Center?
Sign In or Register to comment.