Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

split first name and last name in sql

# Name of table = names_table
# Name of column containing names = full_name
# Simply change the table and column name to what corresponds with your dataset

SELECT LEFT(full_name, STRPOS(primary_poc, ' ') -1 ) AS first_name,  
  		RIGHT(full_name, LENGTH(primary_poc) - STRPOS(primary_poc, ' ')) AS last_name, name
FROM names_table;

# NB: This does not capture middle names
 
PREVIOUS NEXT
Tagged: #split #sql
ADD COMMENT
Topic
Name
2+3 =