2

I'm a freshman in SQL. Now I want to decode the URL characters(like & to &) from the content I get through SQL query. But I don't know what to do.

For example, if I have a SQL query

select name,replace(name,'ss',"") as clientname
from table
where id = 000

and the name includes the character like "&amp" or "&lt",etc. How can decode them to regular characters?

Please help me, thank you.

Meilan
  • 434
  • 6
  • 17
  • @TimBiegeleisen That's URL decoding which is fairly simple. [HTML entity decoding](https://en.wikipedia.org/wiki/Character_encodings_in_HTML#Character_references) is more involved. – Schwern Jun 13 '18 at 03:18
  • 2
    Note that you generally decode *before* inserting data for just this reason. – Schwern Jun 13 '18 at 03:19
  • If, you want to do that inside the database, you'll have to write your own function. It is a repetitive, but simple task. – Laurenz Albe Jun 13 '18 at 05:47

0 Answers0