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

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.
 
Top