Exposed Names

  • I receive the following error when I run this script. What does it mean?

    Msg 1013, Level 16, State 1, Line 2

    The objects "USER_PGM_AUTHORITY" and "USER_PGM_AUTHORITY" in the FROM clause have the same exposed names. Use correlation names to distinguish them.

    SELECT FIRST_NAME, USER_ID

    FROM EMPLOYEE, USER_PGM_AUTHORITY

    LEFT OUTER JOIN USER_PGM_AUTHORITY ON EMPLOYEE.FIRST_NAME = USER_PGM_AUTHORITY.USER_ID

    WHERE FIRST_NAME = USER_ID

  • You're referring to the same table twice for some reason. This should be enough

    SELECT FIRST_NAME, USER_ID

    FROM EMPLOYEE

    LEFT OUTER JOIN USER_PGM_AUTHORITY ON EMPLOYEE.FIRST_NAME = USER_PGM_AUTHORITY.USER_ID

    WHERE FIRST_NAME = USER_ID

    The listing of tables seperated by columns is old ANSI 89 style join syntax. You're using the newer syntax, so there's no need to list tables.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply