• I use PARSENAME all the time: it’s in my quick “design patterns” toolkit that I dip into once in a while. In addition to an IPv4 address, I’ve used it to parse a field with a mixed number of separators: for example something like “ABC/DE/F” and “MN/O”. I wrap the field in a series of nested functions (from inside out):

  • REPLACE to change “/” to “.”
  • REVERSE to change the text order. Position 4 (server name) is now at position 1 (object name): this maps the position to the left to right order of the original text.
  • PARSENAME the field
  • REVERSE the result again to get the text back in order.
  • This might seem to be overkill, but all of this uses built in T-SQL functions and runs very fast.

    Beer's Law: Absolutum obsoletum
    "if it works it's out-of-date"