CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • Microsoft OLE DB Provider for SQL Server error '80040e14' FROM clause have the same exposed names Use correlation names to distinguish them

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    162
  • Date Created
    Thursday, January 12, 2012
  • Last Updated
    Wednesday, June 20, 2012
  • This Article Has been Viewed
    1911 times
  • Short Desc
    When you generate code from SQL Server, the code will not generate this error. However, if you edit the code once you post it to your page, you can in-mistakenly make this simple error, of which, is easy to correct.
  • Details
    When you edit your SQL Script, you will sometimes run into a problem that is simple to correct. This problem happens when you edit the code once you enter it into your page, (or), you may try to hand code the SQL Script, in that case, errors like this are bound to happen more times over than what would happen, if your use SQL Server Management Studio to generate your SQL Script.

     

    Microsoft OLE DB Provider for SQL Server error '80040e14'
    The objects "Cat" and "Cat" in the FROM clause have the same exposed names. Use correlation names to distinguish them.
    /Cat.asp, line 68
  • Recreate Issue
    To recreate this issue.

    <%

    SELECT Cat.SCID, Cat.SubName, SubCat.SCName, SubCat.SCID, SubCat.Image, SubCat.SCDesc FROM Cat INNER JOIN Cat ON Cat.SCID = SubCat.SCID

    %>


    As you can see in the above code sample, we have the
    Cat INNER JOIN Cat

    This is incorrectly written, and will throw the error.
  • Resolve Issue
    To resolve this issue.

    <%

    SELECT Cat.SCID, Cat.SubName, SubCat.SCName, SubCat.SCID, SubCat.Image, SubCat.SCDesc FROM Cat INNER JOIN SubCat ON Cat.SCID = SubCat.SCID

    %>


    As you can see in the above code example. We corrected the table name.
    Cat INNER JOIN SubCat

    This is the proper way to write the above code.