Indent clause content dynamically should add 1 more space

Discussion of open issues, suggestions and bugs regarding database management and development tools for SQL Server
Post Reply
hobiedave
Posts: 16
Joined: Thu 01 Nov 2012 13:39

Indent clause content dynamically should add 1 more space

Post by hobiedave » Thu 01 Nov 2012 13:49

I believe the option to indent clause content dynamically should add one more space. Currently, the algorithm appears to indent up to the next space of the previous line. I believe that the space itself should also be skipped which would result in a more pleasing look by maintaining column alignment.

Current Alignment:

Code: Select all

CREATE FUNCTION dbo.fLookupRecIdBySiteId
(
    @site_id AS INT
)
RETURNS VARCHAR(15)
AS
BEGIN
    DECLARE @ret AS VARCHAR(15)

    SELECT sp.parameter_rec_id
    FROM dbo.sites s
        INNER JOIN dbo.site_parameters sp
                  ON sp.site_id = s.site_id
    WHERE s.site_id = @site_id
         AND sp.parameter_type = 10
         AND sp.parameter_value IS NULL
    ORDER BY sp.parameter_initiate_time DESC

    RETURN @ret
END
GO
Better formatting?:

Code: Select all

CREATE FUNCTION dbo.fLookupRecIdBySiteId
(
    @site_id AS INT
)
RETURNS VARCHAR(15)
AS
BEGIN
    DECLARE @ret AS VARCHAR(15)

    SELECT sp.parameter_rec_id
    FROM   dbo.sites s
           INNER JOIN dbo.site_parameters sp
                   ON sp.site_id = s.site_id
    WHERE  s.site_id = @site_id
           AND sp.parameter_type = 10
           AND sp.parameter_value IS NULL
    ORDER  BY sp.parameter_initiate_time DESC

    RETURN @ret
END
GO
Note also the indenting after FROM, ON, and WHERE. This would be my preference.

alexa

Re: Indent clause content dynamically should add 1 more space

Post by alexa » Thu 01 Nov 2012 15:06

Such formatting option will be implemented in the next version of the product.

Post Reply