I have a SQL query that is returning a huge number of users (175,000) and I want to filter the results a bit more.
One of the ways of doing this would be to check the value of an item held in a users profile.profiledata field.
The field is called ProfileEmailAlert and looks like this
<item key="6882:ProfileEmailAlert" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"><boolean>false</boolean></item>
I want to be able to access this via SQL, but have two issues
1) the data, although being XML, is stored in an NTEXT field.
2) The key is ModuleID:ProfileEmailAlert
So I would need a SQL query that would convert the NText to XML, then search for the item using the moduleID and name and then get the value (false in the example above).
Can anyone help me with the necessary SQL?