Options

Bug? Ctrl+B, Ctrl+Q assigns same alias to both parts of the JOIN

PDinCAPDinCA Posts: 642 Silver 1
Version 7.3.0.775
UPDATE uvu
               SET IncludeInVersionResult = 0
            FROM #UniqueVersions uvu
             WHERE VersionNumber <> 1
                   AND PromotionID IN ( SELECT PromotionID
                                          FROM #UniqueVersions UV
                                         WHERE UV.SlotSetID = SlotSetID
                                               AND UV.SlotNum = SlotNum
                                               AND UV.PromotionID = PromotionID
                                               AND UV.ContentID = ContentID
                                               AND UV.VersionNumber = 1
                                               AND CAST(UV.AssignedGeographies AS nvarchar(max)) <> CAST(AssignedGeographies AS nvarchar(max))
                                      );

Ends up as:
UPDATE uvu
               SET uvu.IncludeInVersionResult = 0
            FROM #UniqueVersions uvu
             WHERE VersionNumber <> 1
                   AND PromotionID IN ( SELECT UV.PromotionID
                                          FROM #UniqueVersions UV
                                         WHERE UV.SlotSetID = UV.SlotSetID
                                               AND UV.SlotNum = UV.SlotNum
                                               AND UV.PromotionID = UV.PromotionID
                                               AND UV.ContentID = UV.ContentID
                                               AND UV.VersionNumber = 1
                                               AND CAST(UV.AssignedGeographies AS nvarchar(max)) <> CAST(UV.AssignedGeographies AS nvarchar(max))
                                      );

The right-hand side qualifiers s/b uvu, not UV.
Jesus Christ: Lunatic, liar or Lord?
Decide wisely...
Tagged:

Comments

  • Options
    James RJames R Posts: 104 Silver 4
    Hey @PDinCA, thanks for the post :smile:

    I've managed to reproduce this locally and logged it in our system, hopefully we'll have a fix soon.

    Cheers,
    James
    Software Engineer
    Redgate Software
  • Options
    Hi @PDinCA

    We're really sorry this forum post has slipped under the radar. We've just tested it on the latest version of SQL Prompt and it seems that development work on our aliasing system has solved this issue. Please don't hesitate to let us know if you're still having problems.

    Thanks,
    Tom
    Software Engineer for SQL Prompt
    Redgate Software
Sign In or Register to comment.