How to fetch a single value from multivalue attribute in sqlI have one table called student.Table has 4 column.
Student : Table
Id Name RollNo SubjectCode
1 Rani B0101 1,3,5,7,12
2 Samidha B0102 1,2,4,6,12
I want to find out name of student whose has subjectcode 2.
select name from student where charindex('2',subjectcode) > 0
But problem occure when subjectcode contain 12.Because 12 contain 2.How to solve it?