473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Splitting one field into two separate fields

1
Hello,

I have a table with one field 'NAME', consisting of the firstname and surname of a person.

I want to split the content of the 'NAME' field into 2 new fields 'FIRSTNAME' and 'SURNAME'. How do I do this with an update query?
Dec 7 '06 #1
3 2550
MMcCarthy
14,534 Expert Mod 8TB
Hello,

I have a table with one field 'NAME', consisting of the firstname and surname of a person.

I want to split the content of the 'NAME' field into 2 new fields 'FIRSTNAME' and 'SURNAME'. How do I do this with an update query?
Assuming there are no middle names, initials or double barreled names.

You can use the following:

Expand|Select|Wrap|Line Numbers
  1. UPDATE TableName SET FIRSTNAME=Left([NAME], InStr([NAME]," ")-1) And SURNAME=Right([NAME], InStr([NAME]," ")+1);
  2.  
Mary
Dec 7 '06 #2
NeoPa
32,556 Expert Mod 16PB
Assuming there are no middle names, initials or double barreled names.

You can use the following:

Expand|Select|Wrap|Line Numbers
  1. UPDATE TableName SET FIRSTNAME=Left([NAME], InStr([NAME]," ")-1) And SURNAME=Right([NAME], InStr([NAME]," ")+1);
Mary
That would give strange results Mary ;) - Try this :
Expand|Select|Wrap|Line Numbers
  1. UPDATE TableName
  2. SET FIRSTNAME=Left([NAME], InStr([NAME]," ")-1),
  3. SURNAME=Mid([NAME], InStr([NAME]," ")+1);
Dec 7 '06 #3
MMcCarthy
14,534 Expert Mod 8TB
Sorry ferdib.

Ade why can't I get that stupid 'AND' out of my head. That's not the first time I've done that.

Mary
Dec 7 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Earl Anderson | last post by:
I have imported an Excel worksheet into A97/WinXPH which had the new employees names in one field ( in a Last Name,First Name configuration). I wanted to split that one field ( ) into two...
5
by: ND | last post by:
I need to create a separate field from 4 fields, "street address", "city", "State" and "zip code". For example, Street address - 100 Forest Street City - Seattle State - WA Zip - 05555 ...
2
by: Gary Lynch | last post by:
I am looking for a simple solution to a recurrent problem with imported data in Access 97. The example below is a simplification of a problem with a much larger database. Let's say I start out...
4
by: Omey Samaroo | last post by:
Dear Access Gurus, Can anyone provide me with some much needed assistance. I would like to combine the contents of 3 text fields into one field. Can someone provide some code or a method to do...
3
by: La di da Limey | last post by:
Hi, I have a field in a database called "Timestamp" which has the date and time of an event, for example: "01/02/2002 09:07:59" The format is MM/DD/YYYY HH:MM:SS I want to chop the field...
1
by: Tony | last post by:
Hi, I have an ID text field that is composed of two alphabetical letters and the rest are numbers. This field is also a primary key. In this same table, I want to separate this field into two...
29
by: Andrea | last post by:
I want to write a program that: char * strplit(char* str1, char *str2, char * stroriginal,int split_point) that take stroriginal and split in the split_point element of the string the string...
4
by: The Facilitator | last post by:
Well, Outlook seems to be making my life more and more challenging. Categories are added in one field and are delimmited via comma. Have three questions on this one... The first is right now...
5
by: mctime | last post by:
Hello, I am attempting to split a raw data table into a new table that has split out a specific field in the raw data and created a new record for each split but I have come to an impasse due to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.