How can we help you today? How can we help you today?

Why does Red Gate SQL Prompt add spaces / tabs between table alias and column name?

One issue I've been having with the SQL Prompt formatter recently is that it has been inserting spaces / tabs between aliases and column names. For example:

FROM dbo.Product p
WHERE p.CategoryId = @ProductCategoryID
AND p.DateActive <= @LastDate
AND p.DateInactive >= @ArrivalDateTime
AND p.PackageOnly = 0
AND (p .BundleOnly IS NULL OR p.BundleOnly = 0)

I do not want it to do this and I can't find the setting that allows it. Also, as you can see from the example, it does not do it consistently.
Matthew_Sontum
0

Comments

7 comments

  • krzysztofkroczak
    Hi @Matthew_Sontum,

    Thanks for letting us know.

    We've tried to replicate the issue locally but so far we've been unable to.

    Would it be possible for you to send us the formatting style (either on the forums or by emailing it to us at sqlpromptteam@red-gate.com) that is throwing up the problem?

    Best regards,
    Krzysztof
    krzysztofkroczak
    0
  • Matthew_Sontum
    It won't let me attach it to the forum, so I have sent it to the email address.
    Matthew_Sontum
    0
  • khkiley
    @Matthew_Sontum Try changing your alias to multiple characters from a single character. This workaround has been working for me.

    K
    khkiley
    0
  • Tianjiao_Li
    Hi @Matthew_Sontum ,

    Thanks for the style file. However, we still couldn't reproduce the issue.

    Can you please upgrade to the latest version if not already and test again?
    Tianjiao_Li
    0
  • Matthew_Sontum
    It is still an issue with the current version, and you can reproduce it with just the following:

    CREATE TABLE dbo.Product (
    SupplierID INT,
    ProductID SMALLINT,
    CategoryId SMALLINT,
    DateActive DATETIME,
    DateInactive DATETIME,
    PackageOnly BIT,
    BundleOnly BIT,
    PRIMARY KEY (SupplierID, ProductID)
    );
    GO

    DECLARE @SupplierID INT,
    @ProductCategoryID SMALLINT,
    @LastDate DATETIME,
    @ArrivalDateTime DATETIME;

    SELECT *
    FROM dbo.Product p
    WHERE p.SupplierID = @SupplierID
    AND p.CategoryId = @ProductCategoryID
    AND p.DateActive <= @LastDate
    AND p.DateInactive >= @ArrivalDateTime
    AND p.PackageOnly = 0
    AND (p .BundleOnly IS NULL OR p.BundleOnly = 0);
    Matthew_Sontum
    0
  • Matthew_Sontum
    khkiley wrote: ยป
    @Matthew_Sontum Try changing your alias to multiple characters from a single character. This workaround has been working for me.

    K

    There was no difference
    Matthew_Sontum
    0
  • Tianjiao_Li
    Hi @Matthew_Sontum

    Thanks for the complete script.

    If you uncheck 'Indent parentheses contents' , it should work as you expect.

    usr4bagbfoub.png
    Tianjiao_Li
    0

Add comment

Please sign in to leave a comment.