Skip to content
Advertisement

SQL: read text inside the span HTML element returned by a query

I have one query that returns the following HTML element:

My query currently looks something like this:

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.

Advertisement

Answer

Try this:

Returns

Using SQL Server’s XML datatype can get you what you need–assuming your HTML is valid.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement