Alias not coming through in join clause
davebren
Posts: 5
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.
However, in the join clause it does NOT add the alias.
Can you replicate? If so, it's a bug.
Comments
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
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com
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
Senior Product Support Engineer
Redgate Software Ltd
Email: support@red-gate.com