I have a column as FullName
containg FirstName
, MiddleName
, LastName
in it.
For example:
FullName: Marilyn Kean Kirkland
I want to have 3 separate columns for FirstName
, MiddleName
and LastName
from the FullName
by taking a substring from it.
I am pulling the FirstName
by using the code:
substring(c.LegalName, 1, CHARINDEX(' ', c.LegalName)) as 'First Name'
I am wondering how can I pull just the middle name which comes after first space and before second space?
Also, I want to pull the last name which comes after the second space?