When you try to execute a SQL Query involving From clause you get the below error:

Msg 1013, Level 16, State 1, Line 1
The objects “Table1” and “Table1” in the FROM clause have the same exposed names. Use correlation names to distinguish them.

Reason for this error:
– Same table is used multiple times in the for clause with out using alias

[sql]
CREATE TABLE Table1(A INT)
GO

SELECT * FROM Table1 join Table1 on Table1.A = Table1.A
[/sql]

Fix:
Give alias names for each table that is repeated in the query.

[sql]
SELECT * FROM Table1 T1 join Table1 T2 on T1.A = T2.A
[/sql]

Leave a Reply

Your email address will not be published. Required fields are marked *