Split Full Name as First and Last

 

DECLARE@FullName VARCHAR(100)

 SET@FullName ='David' 

SELECT

SUBSTRING(@FullName, 1,NULLIF(CHARINDEX(' ', @FullName)- 1,-1))AS [FirstName], 

SUBSTRING(@FullName,CHARINDEX(' ', @FullName)+ 1,LEN(@FullName))AS [LastName]

你可能感兴趣的:(split)