Home Forums SQL Server 2008 T-SQL (SS2K8) Can I Proper case a UK address string with postcode with a function RE: Can I Proper case a UK address string with postcode with a function

  • Well, if you at least have spaces between each element, you could use a string splitter (see Jeff Moden's article here:  http://www.sqlservercentral.com/articles/72993/ ) to get to each element, then as long as an element is not either of the last 2 elements, you UPPER() the leftmost character, and LOWER() the remainder.  Otherwise, the last 2 elements are treated to UPPER() in their entirety.   Then you reassemble the address using STUFF and FOR XML PATH('') and a space for the separator.

    Steve (aka sgmunson) 🙂 🙂 🙂
    Rent Servers for Income (picks and shovels strategy)