Need to rearrange order of names from a fullname column to LAST, SUFFIX, FIRST

  • I currently have a FULLNAME field that is first last and suffix (Laverne Holley, LPN). I am trying to rearrange the name to be LASTNAME, SUFFIX, FIRSTNAME (Holley, LPN, Laverne) that is if there IS a suffix. Does anyone know how I can do this? Thank you!

    CURRENT OUTPUT:

    LAVERNE HOLLEY, LPN

    MEGAN WATERS

    DESIRED OUTPUT

    HOLLEY, LPN, LAVERNE

    WATERS, MEGAN

  • Do all of your existing FULLNAME values conform in format exactly to the two examples you have provided? I ask because names are usually much more complicated to fix than that.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Hello,

    There are a few other name combinations -

    VICKERS BSN RN, LAVERNE

    VICKERS BSN RN, LAVERNE S

    TENELLE JONES, BSN, RN

    MARION M KULINSKI, BSN

    MARION M KULINSKI, BSN, RN

    VICKERS, LAVERNE

    VICKERS, LAVERNE S

    That should be all of them.  Thank you for any guidance or direction.

  • So how do you tell what parts of the name are what? If you can't tell, then SQL Server has no chance. Honestly, if you need names to be in separate parts, you need to initially store them separately. I would suggest that you, as a person, has little chance of working out what name is meant to be what part, and SQL Server will have an even smaller chance. It seems silly, but this is very relevant: Falsehoods Programmers Believe About Names

    Thom~

    Excuse my typos and sometimes awful grammar. My fingers work faster than my brain does.
    Larnu.uk

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply