To see if all the strings in the xml rows are matched for a particular user.
I was thinking something like this:
SELECT t.userId
FROM userToInterestsTable t
WHERE t.interest IN [something like an array i get from the xml string rows]
GROUP BY t.userId
HAVING COUNT(t.userId) = [number of rows in the xml]
But I can not find a way to parse the xml into something like an array without having a specified number of columns. But the number of rows in the xml is dynamic. It is not known before hand.
I know i can do this with an IN clause if I generate the sql statement dynamically, but I want to use a stored procedure to make it more efficient.