I'm trying to use the value from a variable being passed through from elsewhere in my where statement but i'm struggling on syntax.
I have a field that is being passed through where the value with in it is essentially a list
ie @Var1 where the value being passed through is AA','BB','CC (ie its missing the leading ' and trailing '
i want to use this value in my where statement as a list eg
where
field1 IN @Var1
ie - the actual result I want is
where
field1 IN ('AA','BB','CC')
I don't have any control over what is being passed through (ie AA','BB','CC will always be missing the leading and trailing ', so how do i use that info in the IN clause in the WHERE?
I seem to be coming up against issues with syntax around the use of the '
I hope that makes sense, its not the easiest thing to explain and its still relatively new to me