http://www.sqlservercentral.com/blogs/sqltact/2013/02/28/an-item-with-the-same-key-has-already-been-added/

Printed 2014/11/26 04:10PM

"An item with the same key has already been added."

By William Assaf, 2013/02/28

In SQL Server Reporting Services, when adding a new dataset to a report, you may see an error that looks like this:

"An item with the same key has already been added."




















Based on some quick googling, it looks like there are several potential causes for the error, but here's why I received it today.

The stored procedure I had declared as the query source had the same column name declared twice.  Even if you use different data from different tables, even if you declare them differently, SSRS needs all column names in the final dataset to be unique.
select

tablea.samecolumnname

,tableb.samecolumnname

,samecolumnname = tablec.columnname

,tabled.columnname as samecolumnname

...
That error message isn't helpful, but that was the solution for me, for what was a clumsy mistake to begin with.

Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.