Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Reporting Services Development
 An item with the same key has already been added.

Author  Topic 

ALSZ37
Starting Member

25 Posts

Posted - 2014-12-19 : 10:11:22
When I added a dataset I receive this error "An item with the same key has already been added". After research online I understand it is due to me having the same column. I read that the fix is to either rename the column or omit it, but I need both status because they are different for both tables so I aliased them to accomplish this.

I am unable to rename the column name because this is a vendor database and I can't omit them because I need to pull the status. Any ideas or work arounds?


[url]http://arcanecode.com/2010/07/30/ssrs-quick-tip-an-item-with-the-same-key-has-already-been-added/[/url]


select a.field, s.status_name, s1.status_name
from table1 a join table2 b on a.id = b.id
join status_config s on s.status_id = a.status
join status_config s1 on s1.status_id = b.status

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-12-19 : 11:18:14
Alias the columns like this:

select a.field, s.status_name as s_stats_name, s1.status_name as s1_status_name
Go to Top of Page
   

- Advertisement -