Creating reusable logic.
As with Object-Oriented Programming (OOP) where it’s important to separate code used frequently into reusable modules, in T-SQL the same need exists.
In this example I demonstrate a user-defined function (UDF) that receive a string from which all pre-defined matching blocks of HTML are found and replace. The newly “cleansed” version is then sent back to the user.
Once the UDF is called, none of the original HTML characters/tags remained.