Quantcast
Channel: SQL Errors – SQLSERVERLEARNER
Viewing all articles
Browse latest Browse all 74

MSG 1013 – The objects and in the FROM clause have the same exposed names

$
0
0

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

CREATE TABLE Table1(A INT)
GO

SELECT * FROM Table1 join Table1 on Table1.A = Table1.A

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

SELECT * FROM Table1 T1 join Table1 T2 on T1.A = T2.A

Viewing all articles
Browse latest Browse all 74

Trending Articles