Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

How to split and sort name field

Ara_camAra_cam Member Posts: 37
I have a table with a Customer_Name field that holds data like:
Dr. John L. Jones
Dr. James Doe
Dr. Jane Dee Long

I need to sort this data by last name, first name. some rows have a middle name, some have middle initial, and some have no middle at all. All have the Dr. at the beginning.

Any ideas how to do this using SQL?



Comments

  • MrEdMrEd Member Posts: 180
    : I have a table with a Customer_Name field that holds data like:
    : Dr. John L. Jones
    : Dr. James Doe
    : Dr. Jane Dee Long
    :
    : I need to sort this data by last name, first name. some rows have a middle name, some have middle initial, and some have no middle at all. All have the Dr. at the beginning.
    :
    : Any ideas how to do this using SQL?
    :

    Without resorting to PL/SQL, you could do it with a bunch of built-in string manipulation functions like substr, ltrim, length, initcap, instr.
Sign In or Register to comment.