Unix Technical Forum

error 1012: the correlation name '%' has the same exposed name as table '%'.

This is a discussion on error 1012: the correlation name '%' has the same exposed name as table '%'. within the SQL Server forums, part of the Microsoft SQL Server category; --> Im trying to find the error in this statement: CREATE PROCEDURE STP_selectmain AS select a.inventoryid, b.firstname, b.lastname, art.title, art.medium, ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 07:07 PM
Jim
 
Posts: n/a
Default error 1012: the correlation name '%' has the same exposed name as table '%'.

Im trying to find the error in this statement:

CREATE PROCEDURE STP_selectmain


AS

select a.inventoryid, b.firstname, b.lastname, art.title, art.medium,
a.cost, a.inventoryid, a.receivedate, a.dimensions,
a.reference, art.provenance, sum(c.restorationcost),
sum(d.framingcost), sum(e.cost)
from art as a left outer join artist as b on a.artistid =
b.artistid,
a left outer join restoration as c on a.inventoryid =
c.inventoryid,
a left outer join outframing as d on a.inventoryid =
d.inventoryid,
a left outer join basiccosts as e on a.inventoryid =
e.inventoryid

group by a.inventoryid, b.firstname, b.lastname, a.title, a.medium,
a.cost, a.inventoryid, a.receivedate, a.dimensions, a.reference,
a.provenance
order by a.inventoryid desc
GO


eveytime I do a syntax check on it I get this error.

error 1012: the correlation name 'a' has the same exposed name as
table 'a'.

Whats the syntax to fix this?

thanks

-Jim
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 07:07 PM
Erland Sommarskog
 
Posts: n/a
Default Re: error 1012: the correlation name '%' has the same exposed name as table '%'.

Jim (jim.ferris@motorola.com) writes:
> select a.inventoryid, b.firstname, b.lastname, art.title, art.medium,
> a.cost, a.inventoryid, a.receivedate, a.dimensions,
> a.reference, art.provenance, sum(c.restorationcost),
> sum(d.framingcost), sum(e.cost)
> from art as a left outer join artist as b on a.artistid =
> b.artistid,
> a left outer join restoration as c on a.inventoryid =
> c.inventoryid,
> a left outer join outframing as d on a.inventoryid =
> d.inventoryid,
> a left outer join basiccosts as e on a.inventoryid =
> e.inventoryid
>
> group by a.inventoryid, b.firstname, b.lastname, a.title, a.medium,
> a.cost, a.inventoryid, a.receivedate, a.dimensions, a.reference,
> a.provenance
> order by a.inventoryid desc
> GO
>...
> error 1012: the correlation name 'a' has the same exposed name as
> table 'a'.
>
> Whats the syntax to fix this?


You have a mix of old and new FROM syntax, and I would suppose that
you mean:

FROM art AS a
LEFT JOIN artist AS b ON a.artistid = b.artistid
LEFT JOIN restoration AS c ON a.inventoryid = c.inventoryid
LEFT JOIN outframing AS d ON a.inventoryid = d.inventoryid
LEFT JOIN asiccosts AS e on a.inventoryid = e.inventoryid


--
Erland Sommarskog, SQL Server MVP, sommar@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:44 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com