I have a table from which I want to select data. One coloumn 'myCol' has datatype tinyint. It has values from 1 to 8.
In my select I have a variable @myVar with datatype varchar(), that has values like '1,2' or '3,4'.
Now I am trying to do something like this:
select * from myTable
where myCol in (@myVar)
Unfortunately I get the following error:
Conversion failed when converting the varchar value '2,3' to data type tinyint.
How to change the select that it works like it should?!
It's very important to keep the select performance as high as possible!