How to split and sort name field

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

  • : 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.

Howdy, Stranger!

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

Categories

In this Discussion