{"id":156,"date":"2012-04-18T11:54:10","date_gmt":"2012-04-18T11:54:10","guid":{"rendered":"https:\/\/sqlserverlearner.azurewebsites.net\/2012\/04\/18\/msg-1103-the-objects-and-in-the-from-clause-have-the-same-exposed-names\/"},"modified":"2012-04-18T11:54:10","modified_gmt":"2012-04-18T11:54:10","slug":"msg-1103-the-objects-and-in-the-from-clause-have-the-same-exposed-names","status":"publish","type":"post","link":"https:\/\/sqlserverlearner.com\/2012\/04\/18\/msg-1103-the-objects-and-in-the-from-clause-have-the-same-exposed-names\/","title":{"rendered":"MSG 1013 – The objects and in the FROM clause have the same exposed names"},"content":{"rendered":"

When you try to execute a SQL Query involving From clause you get the below error:
\n
\nMsg 1013, Level 16, State 1, Line 1
\nThe objects “Table1” and “Table1” in the FROM clause have the same exposed names. Use correlation names to distinguish them.
\n<\/font><\/p>\n

Reason for this error:<\/strong>
\n– Same table is used multiple times in the for clause with out using alias<\/p>\n

[sql]
\nCREATE TABLE Table1(A INT)
\nGO<\/p>\n

SELECT * FROM Table1 join Table1 on Table1.A = Table1.A
\n[\/sql]<\/p>\n

Fix:<\/strong>
\nGive alias names for each table that is repeated in the query.<\/p>\n

[sql]
\nSELECT * FROM Table1 T1 join Table1 T2 on T1.A = T2.A
\n[\/sql]<\/p>\n","protected":false},"excerpt":{"rendered":"

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…<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[128],"tags":[1588,1589,1590,1591],"_links":{"self":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/156"}],"collection":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/comments?post=156"}],"version-history":[{"count":0,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/posts\/156\/revisions"}],"wp:attachment":[{"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/media?parent=156"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/categories?post=156"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlserverlearner.com\/wp-json\/wp\/v2\/tags?post=156"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}