This is a sample query
select *
from tablename
where tableid in (<sub query>);
The <sub query> here returns null or a string of pattern 'id1','id2','id3'
My <sub query> is something like:
select xml_data.value('(/Node/SubNode)[1]', 'varchar(max)'))
from tablename
where tableid = '9944169f-95a6-4570-89d7-b57a3fe1b693'
The problem :
My sub query returns proper data ('id1','id2','id3') but the parent query considers the complete result as one single string and hence returns 0 rows always.
How can I tell SQL Server not to escape single quotes present in the result of my sub-query?
It’s not clear if your subquery is applying to the same table as the first query, but this should show you the general direction