Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Getting error "...have the same exposed names. Use correlation names to distinguish them."

Posted on 2006-07-08
6
Medium Priority
?
5,744 Views
Last Modified: 2007-12-19
I have table [Product].Items and table [Technology].Items
Note that Product and Technology are schema names, so more accurately, I have table Items in schema Products and table Items in schema Technology.

When I try to execute
SELECT [Product].Items.* FROM [Product].Items LEFT OUTER JOIN [Technology].Items ON [Product].Items.ItemID = [Technology].Items.ID

I get the error
Msg 1013, Level 16, State 1, Line 1
The objects "technology.items" and "product.items" in the FROM clause have the same exposed names. Use correlation names to distinguish them.

Why is this error occuring and what do I need to do to fix it?
0
Comment
Question by:stev0931
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 17065399
Not sure about this , can you replace * with the desired column names in the Query

SELECT ProItms.Column1,  ProItms.Column2,ProItms.Column3
FROM [Product].Items ProItms
LEFT OUTER JOIN [Technology].Items
ON ProItms.ItemID = [Technology].Items.ID
0
 

Author Comment

by:stev0931
ID: 17065404
No, I get the same error
0
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 2000 total points
ID: 17065419
try this


SELECT ProItms.*
FROM [Product].Items ProItms
LEFT OUTER JOIN [Technology].Items  TechItms
ON ProItms.ItemID = TechItms.ID
0
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 

Author Comment

by:stev0931
ID: 17065429
That works, but it requires rewriting all multi-part identifyers (i.e. the TechItms.ID cannot be written as [Tech].Items.ID), which will require me to go through and rewrite a bunch of code.

Is there any other way of fixing this?
0
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 2000 total points
ID: 17065439
The only way i feel is to provide the aliases for those tables...
0
 

Author Comment

by:stev0931
ID: 17065681
Thanks!
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question