How to order by last name on a full name column?

Posted by GateKiller on Stack Overflow See other posts from Stack Overflow or by GateKiller
Published on 2010-06-16T13:21:08Z Indexed on 2010/06/16 13:32 UTC
Read the original article Hit count: 244

Filed under:

I have a SQL Table with a column called FullName which contains, for example, "John Smith".

How can order the data by the last name that appears in the FullName column?

For a long name like "Laurence John Fishburne", I would like to order the data by the word "Fishburne".

Thus, names are stored in the order

  • First Name
  • Middle Names
  • Last Name

I am using Microsoft SQL Server 2005.

© Stack Overflow or respective owner

Related posts about sql-server