HtmlDecode

Decodes a string that may contain HTML numeric character references or HTML character entity references.

  • Free Function
  • SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017

Syntax:

SELECT SQLHTTP.net.HtmlDecode ( @String )

Arguments:

Name Type Description
@String nvarchar(MAX) Any character string, variable, or expression.

Return Type:

nvarchar(max)

Remarks:

See the following Wikipedia articles for a Character Entity References in HTML and Numeric Character Reference in HTML

Sample Usage:

Decoding a string containing HTML character entity references:

SELECT SQLHTTP.net.HtmlDecode(‘I can now encode & decode an HTML string using SQL Server’)
———————————————————————————————–
I can now encode & decode an HTML string using SQL Server

Decoding a string containing HTML numeric character references:

SELECT SQLHTTP.net.HtmlDecode(‘I can now encode & decode an HTML string using SQL Server’)
———————————————————————————————–
I can now encode & decode an HTML string using SQL Server

See Also: