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

Alias not coming through in join clause

When I set an alias in the SQL Prompt options and choose it in the FROM clause, Prompt appropriately applies the alias.

However, in the join clause it does NOT add the alias.

Can you replicate? If so, it's a bug.
davebren
0

Comments

3 comments

  • Eddie D
    Thank you for post into the forum.

    I believe that I have recreated the reported fault symptoms.

    SQL Prompt automatically applies the alias where the table or view name is typed, for example 'mytable AS m'

    When creating a simple join and apply the alias, SQL Server errors out.

    When the alias is removed, the join statement runs without errors.

    Can you please reply back with your join script, so I can confirm that I have recreated your fault symptoms.

    Eddie Davis
    Red Gate Software Ltd
    Technical Support Engineer
    E-Mail: Support@red-gate.com
    Eddie D
    0
  • davebren
    To me it seems to be intermittent and unpredictable. Sometimes it works, sometimes it doesn't.
    davebren
    0
  • Eddie D
    SQL Prompt will not alias in the SELECT statement. For example if your JOIN statement is something like this:

    SELECT [table1].*, [table2].*
    FROM [table1] AS A INNER JOIN [department] AS A2
    ON [A].[dept_no] = [A2].[dept_no]

    SQL Prompt will not alias the SELECT statement, so if you execute the above syntax it will fail, unless you manually change the SELECT statement to:


    SELECT [A].*, [A2].*
    FROM [table1] A INNER JOIN [table2] A2
    ON [A].[column] = [A2].[column]

    Also this statement will also be successful:

    SELECT *
    FROM [table1] A INNER JOIN [table2] A2
    ON [A].[column] = [A2].[column]

    Is this the style Intermittent error you are receiving? If not can you please reply with an example?

    Many Thanks
    Eddie

    Eddie Davis
    Red Gate Software Ltd
    Technical Support Engineer
    Eddie D
    0

Add comment

Please sign in to leave a comment.