I have one query that returns the following HTML element:
<span CreatedFromTXTextControl="1" style="font-family:Tahoma;font-size:8pt;">
<p lang="en-US" style="text-indent:0pt;margin-left:0pt;margin-top:0pt;margin-bottom:6pt;margin-right:0pt;line-height:100%;" xmlns="http://www.w3.org/1999/xhtml"><span style="font-family:'Tahoma';font-size:8pt;">I am not sure how to extract this text using SQL.</span></p>
</span>
My query currently looks something like this:
SELECT text
FROM MyTable
How shall I change this query to return only the text inside the span
element shown above?
In the example above the result should be the string:
I am not sure how to extract this text using SQL.
.
DBMS implementation: MS SQL Server.
text
`? Do they all have these extra style attributes? If there's a lot of consistency here you may be able to "cheat" parsing the HTML and split up strings. For instance, maybe you can find the location of ``, split the string, and replace `` with an empty string, and you'll be left with your text. – WOUNDEDStevenJones Nov 02 '20 at 16:00