title: HTML Encoding in T-SQL?
body: <p>Is there any function to encode HTML strings in T-SQL? I have a legacy database which contains dodgey characters such as '&lt;', '>' etc. I can write a function to replace the characters but is there a better way?</p>
  
  <p>I have an ASP.Net application and when it returns a string it contains characters which cause an error. The ASP.Net application is reading the data from a database table. It does not write to the table itself.</p>