problem in deleting data from hierarchical table RRS feed

  • General discussion

  • Hi,

    There is a problem with hierarchical table(Child/Parent) which they reference themselves. like:

    DELETE [dbo].[TableName]
     FROM [dbo].[TableName]
    JOIN [dbo].[TableName] 
     ON  [dbo].[TableName].[ParameterId] =  [dbo].[TableName].[ParentParameterId]

    and we will get an error:

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

    • Moved by Bill_Stewart Wednesday, September 6, 2017 7:21 PM Off-topic
    Wednesday, September 6, 2017 2:43 PM

All replies

  • This is not a SQL forum.  Please post SQL issues in the correct SQL forum.

    Please look up and understand what a "correlation name" is in SQL.

    select * from table As T1



    Wednesday, September 6, 2017 2:48 PM