webdork
asked on
SQL server split column
In SQL Server:
I've got a FullName column formatted like:
Smith, Tom
I want to split out the values to separate columns:
FirstName
LastName
I've got a FullName column formatted like:
Smith, Tom
I want to split out the values to separate columns:
FirstName
LastName
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just interchange the column names''UPDATE urTable SET
LastName= SUBSTRING(FullName,1,CHARI NDEX(',',F ullName)-1 ),
FirstName = LTRIM(SUBSTRING(FullName,C HARINDEX(' ,',FullNam e)+1,LEN(F ullName)))
LastName= SUBSTRING(FullName,1,CHARI
FirstName = LTRIM(SUBSTRING(FullName,C
ASKER
Thank You
ASKER