I have an XML variable with only one element in it. I need to check if this element has a particular attribute, and if it does, i need to check if that attribute has a specific value, and if it does, i need to remove that attribute from the XML element.
So lets say I have
DECLARE @Xml XML
SET @XML =
'<person
FirstName="Harvey"
LastName="Saayman"
MobileNumber="Empty"
/>'
The MobileNumber attribute may or may not be there, if it is, and the value is "Empty", i need to change my XML variable to this:
'<person
FirstName="Harvey"
LastName="Saayman"
/>'
I'm a complete SQL XML noob and have no idea how to go about this, any ideas?