Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Name field can be a mixture of formats, for example: Mr. First Last, Mr First Last, First M Last, First M. Last, First Last Snr, First M Last Snr, First Last-Last, etc.

share|improve this question
Not strictly SQL, but you would need coding in a language such as VBA, which is included with Microsoft Office. Someone wiser would probably be able to answer – Canadian Luke Feb 18 '12 at 23:30

You could use Regular Expressions (not sure what tools you have at your disposal?), or as the comment suggests a good scripting language, to strip the Mr./Mrs. etc. However as far as returning the First and Last name in order from a Name field that mixes them together as you displayed is more than likely next to impossible.

The reason for this is - how are you going to tell what is the first name and last name? Michael Matthew could actually be Matthew Michael. Or what if his full name was Michael Francis Matthew - mixed together in that format Michael Francis and Matthew could all be the first name. You may want to consider redesigning the structure of your db to separate First, Middle, and Last names.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.