Options

Alias not coming through in join clause

davebrendavebren Posts: 5
edited May 15, 2007 9:14AM in SQL Prompt Previous Versions
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.

Comments

  • Options
    Eddie DEddie D Posts: 1,780 Rose Gold 5
    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 Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Options
    To me it seems to be intermittent and unpredictable. Sometimes it works, sometimes it doesn't.
  • Options
    Eddie DEddie D Posts: 1,780 Rose Gold 5
    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 Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.