473,785 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Splitting data

We have a database of books, which includes a field "Author"

Authors are listed like:

Annabel Langbein
Alison Holst
Fred Reichelman

I would like to create a table of authors with seperate fields for
FirstName and LastName based on the table above (some 2000 + authors).
Can I run a query to split the contents of the original Author field
based on the space between the first and last name, noting that the
length of each name varies. Is it possible to do this with an
expression in a select query.

If someone could show me how, it would be much appreciated

Regards
Jan 5 '08 #1
3 1505
Yes. In the Field row in query design, you can type an expression that
parses the 2 words, breaking at the space.

Use Instr() to locate the space, Left() and Len() to get the first word,
Mid() to get the remainder.

If some entries might have multiple spaces, such as Robert Louis Stevenson,
use InstrRev() to get the last space.

If it helps, there's a ParseWord() function here that parses the n-th word:
http://allenbrowne.com/func-10.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"zazu" <mi***********@ gmail.comwrote in message
news:83******** *************** ***********@n22 g2000prh.google groups.com...
We have a database of books, which includes a field "Author"

Authors are listed like:

Annabel Langbein
Alison Holst
Fred Reichelman

I would like to create a table of authors with seperate fields for
FirstName and LastName based on the table above (some 2000 + authors).
Can I run a query to split the contents of the original Author field
based on the space between the first and last name, noting that the
length of each name varies. Is it possible to do this with an
expression in a select query.

If someone could show me how, it would be much appreciated

Regards
Jan 5 '08 #2
"zazu" <mi***********@ gmail.comwrote in message
news:83******** *************** ***********@n22 g2000prh.google groups.com...
We have a database of books, which includes a field "Author"

Authors are listed like:

Annabel Langbein
Alison Holst
Fred Reichelman

I would like to create a table of authors with seperate fields for
FirstName and LastName based on the table above (some 2000 + authors).
Can I run a query to split the contents of the original Author field
based on the space between the first and last name, noting that the
length of each name varies. Is it possible to do this with an
expression in a select query.

If someone could show me how, it would be much appreciated

Regards
So long as you're sure it's ALWAYS first name space last name, this will
create a table called NewTable with the fields split the way you want:

SELECT Left([Author],InStr(1,[Author]," ")-1) AS FirstName,
Mid([Author],InStr(1,[Author]," ")+1) AS LastName INTO NewTable
FROM Books;
Jan 5 '08 #3
On Jan 5, 3:52*pm, "Allen Browne" <AllenBro...@Se eSig.Invalidwro te:
Yes. In the Field row in query design, you can type an expression that
parses the 2 words, breaking at the space.

Use Instr() to locate the space, Left() and Len() to get the first word,
Mid() to get the remainder.

If some entries might have multiple spaces, such as Robert Louis Stevenson,
use InstrRev() to get the last space.

If it helps, there's a ParseWord() function here that parses the n-th word:
* *http://allenbrowne.com/func-10.html

--
Allen Browne - Microsoft MVP. *Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"zazu" <mike.drean...@ gmail.comwrote in message

news:83******** *************** ***********@n22 g2000prh.google groups.com...
We have a database of books, which includes a field "Author"
Authors are listed like:
Annabel Langbein
Alison Holst
Fred Reichelman
I would like to create a table of authors with seperate fields for
FirstName and LastName based on the table above (some 2000 + authors).
Can I run a query to split the contents of the original Author field
based on the space between the first and last name, noting that the
length of each name varies. Is it possible to do this with an
expression in a select query.
If someone could show me how, it would be much appreciated
Regards
Thanks. Very helpfull
Jan 5 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
2236
by: qwweeeit | last post by:
Hi all, I am writing a script to visualize (and print) the web references hidden in the html files as: '<a href="web reference"> underlined reference</a>' Optimizing my code, I found that an essential step is: splitting on a word (in this case 'href'). I am asking if there is some alternative (more pythonic...): # SplitMultichar.py
8
1572
by: M O J O | last post by:
Hi, I'm creating an CRM solution for my company. I want to split up the solution into several classlibraries, so I dont need to build the entire solution every time I run my project. First I thought about splitting my application up into these libraries: Solution (solution)
3
4143
by: Rakesh | last post by:
Hi, I was 'googling' to look out for some ways of optimizing the code and came across this term - 'hot / cold splitting'. In short, the discussion is about splitting heavily accessed ( hot ) portions of data structure from rarely accessed cold portions. I haven't used this one myself anytime before, but am interested in learning more about this. Can you please share your experience here, so that I can understand better and this could...
11
1685
by: Steve Darby | last post by:
Can anyone help with this problem. I am attempting to dynamically draw a graph using data from a cookie. I have written the script to actually draw the graph, for which I hav created two arrays with the data I required preset into them. What I wish to do is split the cookie in which the data is stored and create two array from it. The function used to create the cookie is as follows :function SetCookie(name, value) {...
13
2679
by: James Conrad St.John Foreman | last post by:
One of the larger tables in our database is now 6.8 million rows (1 per financial transaction since 2000). Every time an amendment is made to a booking, new rows are added to the table for each transaction, so in general we never have any call to update old rows. Usually, we only deal with analysis on transactions in the current financial year or the previous one, but *occasionally* we'll want to go back further. So I'm thinking as...
6
2469
by: Earl Anderson | last post by:
I have a A97/XP applet I've developed for my own use in my department. My boss "suggests" that since I built it, I share it with and instruct the other 6 members of my department on its use. I've read many pieces on using the 'Database Splitter' Wizard, however I'm still unsure of what exactly will be the end result and what would remain for me to do afterwards. Being somewhat hesitant (aka Chicken) to do it without knowing all the...
20
3721
by: Opettaja | last post by:
I am new to c# and I am currently trying to make a program to retrieve Battlefield 2 game stats from the gamespy servers. I have got it so I can retrieve the data but I do not know how to cut up the data to assign each value to its own variable. So right now I am just saving the data to a txt file and when I look in the text file all the data is there. Not sure if this matters but when I open the text file in Word pad (Rich Text) It...
4
5377
by: Michael Yanowitz | last post by:
Hello: For some reason I can't figure out how to split a 4-byte (for instance) float number (such as 3.14159265359) into its 4-bytes so I can send it via a socket to another computer. For integers, it is easy, I can get the 4 bytes by anding like: byte1 = int_val & 0x000000FF byte2 = int_val & 0x0000FF00 byte3 = int_val & 0x00FF0000
2
3273
by: shadow_ | last post by:
Hi i m new at C and trying to write a parser and a string class. Basicly program will read data from file and splits it into lines then lines to words. i used strtok function for splitting data to lines it worked quite well but srttok isnot working for multiple blank or commas. Can strtok do this kind of splitting if it cant what should i use . Unal
3
2016
by: salad | last post by:
I have an A97 application that is NOT split on a network. It is used by 15+ folks continually. It is quick and fast. I split it several years ago and had to merge it together again after the folks rebelled at the slow speed resulting from the split. I have to bite the bullet and split it now. Of course, it is much slower. In one form that opens as a continous form, the data looks like it is being repainted as it displays...you can...
0
10346
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5386
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.