Split Full name into First Middle and Last

jbandley 🟑

I am looking for a good way to split a full name into First Middle and Last. What is the best way to go about this.

Examples of possible name formats

Doe, John

Doe, John M

Doe, Joe James

Doe, John Henry

Doe-Kahn, John

Aba Doe, John

Best Answer

  • MarkSnodgrass
    MarkSnodgrass Portland, Oregon 🟀
    Accepted Answer

    You can use the SPLIT_PART function primarily to split these all out:

    First Name

    SPLIT_PART(TRIM(SPLIT_PART(`Name`,',',2)),' ',1)

    Last Name


    Middle Name

    SPLIT_PART(TRIM(SPLIT_PART(`Name`,',',2)),' ',2)

    Based on your examples, this will do the trick.