MS Access Query: Splitting Name field into First, Middle and Last Name

The following Code snippet is used to split up the FullName field of MS Access into First, Middle and Last Name based on delimiter space.



SELECT Left(FullName,instr(FullName , ' ')) AS [First Name], Right(FullName, ( Len

(FullName) - Instrev(FullName, ' ')) ) As [Last Name], Mid ( FullName, instr

(FullName , ' ') + 1, Instrev(FullName, ' ') - instr(FullName , ' ') - 1) As

[Middle Name]

FROM [Employee];




Assume the FullName Field of Employee table contains

FullName

Viji R Raj

Bob A Antony

Cath B Mony

OUTPUT

First Name Last Name Middle Name

Viji Raj R

Bob Antony A

Cath Mony B

Reference: http://vijirajkumar.blogspot.com/2009/06/splitting-name-field-into-first-middle.html


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: