How to split the full name into FirstName and LastName in SQL server?
9915-Oct-2024
Updated on 15-Oct-2024
Ashutosh Kumar Verma
15-Oct-2024To split a
FullName
intoFirstName
andLastName
in SQL Server, you can use string functions like CHARINDEX, LEFT and RIGHT. Here is an example of how you can do this,Assuming you have an SQL table
Employees
with a columnEmpName
that contains the name in the format of “FirstName and LastName”,Here is the SQL Query to split the full name into first name and lastname
Example-