473,414 Members | 1,878 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,414 software developers and data experts.

Separating Address Field into Multiple Fields

I'm new to both SQL and this message board so please be kind.

I've got a large dataset (1.9 million records) with various information. Within this dataset, there is an address field that is specific to each record. Unfortunately, to do what I need to do with this information, the address information needs to be split into other fields (name, street address, city, state). Records differ from each other in that one may have a name and the next may not. Each normally has multiple spaces where I would need to split them, but again, that differs from record to record.

Since I'm new to SQL, I'm either not grasping the entire process or I'm completely over thinking it... but nothing is working. Any assistance would be greatly appreciated! Thanks in advance.
Jun 19 '07 #1
1 5968
I'm new to both SQL and this message board so please be kind.

I've got a large dataset (1.9 million records) with various information. Within this dataset, there is an address field that is specific to each record. Unfortunately, to do what I need to do with this information, the address information needs to be split into other fields (name, street address, city, state). Records differ from each other in that one may have a name and the next may not. Each normally has multiple spaces where I would need to split them, but again, that differs from record to record.

Since I'm new to SQL, I'm either not grasping the entire process or I'm completely over thinking it... but nothing is working. Any assistance would be greatly appreciated! Thanks in advance.

You can try this using string functions
Create a table called table1 having columns address information,city,state,zip,name.
Now insert the address information from original table to table1.Now you have to split this address information into city,state,zip,name.

code to extract the city name only

UPDATE table1
SET CITY=Rtrim(substring(city,1,charindex(',',city) -1))

code to extract zip only

UPDATE APR07
SET ZIP=LTRIM(SUBSTRING(city, CHARINDEX(' ', city) + 1, LEN(city)))
Jun 19 '07 #2

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

Similar topics

2
by: michael nieuwenhuizen | last post by:
how do i create a sticky form with multiple fields? say i want a form with: name: address: country: and if a user presses the submit button it will show
1
by: mark.reichman | last post by:
First off.. Thanks to Grant Wagner for help in a previous thread related to this one. I am at a total loss... I have multiple fields in a form with the same name. Lets call the fields with the...
2
by: PPT33R | last post by:
The MS Access website is very unhelpful on this topic, and I cannot find anything in my Googling to find a hint. I am working with very large, existing data sets that consist of multiple fields....
3
by: tesc | last post by:
I am so aggravated and need any help I can get. I am using Access 2000 and am trying to sort multiple fields in a select query. My query is set up as follows: FIELD 1 FIELD 2 FIELD 3 ...
3
by: mkjets | last post by:
I have worked for hours on trying to find a solution and have not figured it out. I am working in Access 2003. I need to create a query that takes values from 1 table and displays them in...
4
4Him
by: 4Him | last post by:
First off, let me say this is a great site! I've just started working with Access and much of my success is from what I've read here! Background: I have a form, driven off a single table. Goal:...
10
by: H | last post by:
Hi, I have the following address fields in a table: flat_number house_name_or_number street village postal_town county postcode
2
by: Nathan Sokalski | last post by:
I have a Repeater that uses a DataSource that has multiple fields. When the values of these fields is displayed in the Repeater, there are fields that are used in combination with other fields as...
1
code green
by: code green | last post by:
I am migrating data from DB1 to DB2 via csv. In DB1 there is only one address field 'address' that contains carriage returns between each address line. DB2 however has three fields for the address...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.