Hy , I have multiple values and i need a list of checks
ex:
1,2,4,
3,4,
should be :
day1 day2 day3 day4
_1____1____0____1
_0____0____1____1
one method is
CAST(CASE WHEN PATINDEX('1,', [day]) > 0 THEN 1 ELSE 0 END AS BIT) as [day1],
CAST(CASE WHEN PATINDEX('2,', [day]) > 0 THEN 1 ELSE 0 END AS BIT) as [day2],
CAST(CASE WHEN PATINDEX('3,', [day]) > 0 THEN 1 ELSE 0 END AS BIT) as [day3],
CAST(CASE WHEN PATINDEX('4,', [day]) > 0 THEN 1 ELSE 0 END AS BIT) as [day4]
please help me with a better method because i have multiple columns
thanks