Appending

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

One a table, i have this column that has users lastname,firstname
I need to have it append to another table but break the last name and first
name
the way the name appears on the first table is Lastname,Firstname. Please help
 
Here's a quote from something I posted the last time this question was asked
....

UPDATE tblTest SET tblTest.firstname =
Left$([fullname],InStr(1,[fullname],",")-1), tblTest.lastname =
Mid$([fullname],InStr(1,[fullname],",")+1);

You're sure there's no space after that comma? You'll need to modify the
above slightly if there is - change the "+1" to "+2".
 
Justin said:
One a table, i have this column that has users lastname,firstname
I need to have it append to another table but break the last name and
first name
the way the name appears on the first table is Lastname,Firstname.
Please help

If at all possible you should be saving this data in one table and
always as two fields.

Why do you need the same data in two tables? Why do you want the data
saved with both names in a single flied in the first table?

First step in dividing the names is to determine how consistent is the
data. Is each and ever one in the exact format of Lastname,Firstname? No
spaces no Jones,Mary (Smith) etc.
 
Try this

INSERT INTO Table2 ( lastname,firstname)
SELECT left(Table1.Name,instr(Table1.Name,",")-1),
mid(Table1.Name,instr(Table1.Name,",")+1)
FROM Table1

Assuming that the "," seperating between the first and last name
 

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

Similar Threads


Back
Top