This function takes a pattern to be searched for, a string that the pattern will be removed from and a flag to determine whether all instances of the pattern should be removed.
This is sort of an expanded version of a function I wrote to remove multiple spaces from a string.
For most DBAs, normalization is an understood concept, a bread and butter bit of knowledge. However, it is not at all unusual to review a database design by a development group for an OLTP (OnLine Transaction Processing) environment and find that the schema chosen is anything but properly normalized. This article by Brian Kelley will give you the core knowledge to data model.