Welcome to MSSQL Forum!
MSSQL Forum - Discussions about Microsoft SQL Server

You are currently viewing our community forums as a guest user. Sign up or
Having an account grants you additional privileges, such as creating and participating in discussions.

SSRS Error - An item with the same key has already been added

Discussion in 'Business Intelligence' started by Peter Schmitz, Aug 3, 2017.

  1. Peter Schmitz

    Peter Schmitz Administrator Staff Member

    I was working on an SSRS report today. It's a fairly straightforward process; select a data source, paste in a query, and click "Next".

    Not with this report. The error in the title popped up for me. It's a pretty non-descriptive title, though, so I popped open the Query Builder, hoping to find some kind of a hint there. Luckily, it did. In the "Alias" column, look for "Expr1".

    The root cause of the error in my case was that I was doing a self-join in my table, and pulling out the same field for both ends of the query, thus creating two columns with the same name. Apparently this is not something SSRS is particularly happy with, and thus the above error will end up being thrown.

    The solution, of course, is to properly alias the columns.

Share This Page