April 29, 2019 at 4:58 pm
Everything worked great until i added this snippet.
I want a column that tells me what "ID" matched a parameter value.
When i run this, I get: An item with the same key has already been added error
,CASE
WHEN T.[PD_ID] in (@Part)
THEN 'PD_ID_Match'
WHEN T.[Flat_PD_ID] in (@Part)
THEN 'FLAT_PD_ID_Match'
WHEN T.[Like_PD_ID] in (@Part)
THEN 'Like_PD_ID_Match'
WHEN T.[Flat_Like_PD_ID] in (@Part)
THEN 'Flat_Like_PD_ID_Match'
END as Field_Match
Thoughts? thanks
April 29, 2019 at 5:39 pm
Note: this works in SSMS, but crashes in SSRS.
April 29, 2019 at 5:53 pm
Maybe try CASTing to an explicit length?:
,CASE
WHEN T.[PD_ID] in (@Part)
THEN CAST('PD_ID_Match' AS varchar(30))
WHEN T.[Flat_PD_ID] in (@Part)
THEN CAST('FLAT_PD_ID_Match' AS varchar(30))
WHEN T.[Like_PD_ID] in (@Part)
THEN CAST('Like_PD_ID_Match' AS varchar(30))
WHEN T.[Flat_Like_PD_ID] in (@Part)
THEN CAST('Flat_Like_PD_ID_Match' AS varchar(30))
END as Field_Match
SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".
April 30, 2019 at 9:37 am
This was removed by the editor as SPAM
April 30, 2019 at 9:38 am
This was removed by the editor as SPAM
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply