I'm thinking there's no easy way around this, but figured it's worth a try.
I have a table PerfPeriods with two fields, EmpID INT and Periods varchar. Periods contains a comma seperated list.
EmpID Periods
1 1,2
2 2,4
Is there any way to join this to another table, then use the Periods field in the IN Clause?
ie.
SELECT *
FROM Performance a
JOIN PerfPeriods b ON a.EmpID = b.EmpID
WHERE a.Period IN (a.Periods)
Doing that as is returns the error converting to INT as SQL Server doesn't see it as a comma seperated list.
I have a table PerfPeriods with two fields, EmpID INT and Periods varchar. Periods contains a comma seperated list.
EmpID Periods
1 1,2
2 2,4
Is there any way to join this to another table, then use the Periods field in the IN Clause?
ie.
SELECT *
FROM Performance a
JOIN PerfPeriods b ON a.EmpID = b.EmpID
WHERE a.Period IN (a.Periods)
Doing that as is returns the error converting to INT as SQL Server doesn't see it as a comma seperated list.