get first name and last name from full name string in sql

Solutions on MaxInterview for get first name and last name from full name string in sql by the best coders in the world

showing results for - "get first name and last name from full name string in sql"
Michele
25 Aug 2017
1DECLARE @FullName    VARCHAR(50) = 'Mark Zuckerberg'
2
3SELECT SUBSTRING(@FullName, 1, CHARINDEX(' ', @FullName) - 1) AS [First Name],
4       SUBSTRING(@FullName, CHARINDEX(' ', @FullName) + 1, LEN(@FullName)) AS [Last Name]
5