I have a TEXT datatype field called "XMLText" in SQL Server 2012. What I'd like to do is remove any SageID fields. So this long string field contains something that looks like this:
<pair n="priorinstitution2" v="Yale School of Medicine" />
<pair n="priorinstitution3" v="" />
<pair n="sageid" v="20668528" />
<pair n="priorinstitution1" v="University of Chicago" />
What I'd like to do is remove everything for the SageID tag so that the final result is this:
<pair n="priorinstitution2" v="Yale School of Medicine" />
<pair n="priorinstitution3" v="" />
<pair n="priorinstitution1" v="University of Chicago" />
Obviously, it's not in a fixed position in the field and the v= could be any numbers or length. What's the SQL string manipulation to do this?
sageidor multiple per row? DemoTEXTdatatype which will be removed in futureSql serverversions. UseXMLdatatype to store xml data