I am trying to parse the HTML data which exists in one of my table but issue is the table size is huge and I can't use the function provided here. I was just wondering if there is any efficient way to parse the data from a huge table.
I tried the solution here and it works great but can't use for huge table. https://blog.sqlauthority.com/2007/06/16/sql-server-udf-user-defined-function-to-strip-html-parse-html-no-regular-expression/
Sample code here: http://sqlfiddle.com/#!18/27baba/1
Data looks like this:
ID Valuen
1 <t><some>this is the value</t></some>another value . <none> 3rd value </none>
2 <t><bold>Correct value </t></bold>new value . <color> salary </color>
Sample Output:
ID Valuen
1 this is the value another value 3rd value
2 Correct value new value . salary
Please note that I tried using XML parsing as well but it does not work as its unable to convert all the data to XML.
Any help will be appreciated, thank you.
2条答案
按热度按时间a11xaf1n1#
If open to a helper function
Normalized Example or dbFiddle
Returns
Same as Above, Just Added a
string_agg()
Results
The Function if Interested
wj8zmpe12#
Please try the following solution on your data set.
SQL
Output