I'm trying to query a ticketing system, where multiple users can be assigned to a ticket at once.
It stores the assignees as comma-delimited values in a column AH.AssignedTo_ETrack_UserID.
For example: 429173,525304,390497
When I try to run the following, the JOIN fails because of the comma.
SELECT
DISTINCT(RI.ID) as REQ_NUM
,HT.FullName
FROM
RequestInfo RI
LEFT OUTER JOIN
RequestAssignInfoHistory AH ON RI.ID = AH.RequestInfo_ID
LEFT OUTER JOIN
WA_Team HT ON AH.AssignedTo_ETrack_UserID = HT.ID
Error message:
Msg 245, Level 16, State 1, Line 2
Conversion failed when converting the nvarchar value '429173,525304,390497' to data type int.
Any thoughts on how to do this?
I only have READ rights to this system, so I can't create a function.