Splitting 1 column into 2

J

Joey Martin

Pretty basic but I cannot figure it out.

Column:
FULLNAME (lname, fname)

Needs to be

FNAME
LNAME

Should split at the comman. I already have all the columns created; just
need to SQL command to make it happen. Thanks!!
 
T

Turkbear

Pretty basic but I cannot figure it out.

Column:
FULLNAME (lname, fname)

Needs to be

FNAME
LNAME

Should split at the comman. I already have all the columns created; just
need to SQL command to make it happen. Thanks!!

To do it at the database level is database specific, but in general:

select substr(FULLNAME,Instr(FULLNAME,",") +1) First_Name,substr(FULLNAME,1,Instr(FULLNAME,",") -1) Last_Name
from table


Your exact systax will vary but basically you need to find the position of the , and use the string functions of your
database to split it as needed.
 
B

Bob Barrows [MVP]

Joey said:
Pretty basic but I cannot figure it out.

Column:
FULLNAME (lname, fname)

Needs to be

FNAME
LNAME

Should split at the comman. I already have all the columns created;
just need to SQL command to make it happen. Thanks!!

More info please:
What database type and version are you using?
What do you want to do with the data once it is split?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,075
Members
48,772
Latest member
Backspace Studios

Latest Threads

Top