Connecting Tech Pros Worldwide Help | Site Map

Want to break a column text in two column

Newbie
 
Join Date: Dec 2006
Posts: 2
#1: Dec 11 '06
Dear friends,
I have a problem.I want to break a column in which Address text is written, into two other column for Ist adrress and 2nd City.How Can i do this.
Thanks
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,706
#2: Dec 11 '06

re: Want to break a column text in two column


Quote:

Originally Posted by ajaygiri786

Dear friends,
I have a problem.I want to break a column in which Address text is written, into two other column for Ist adrress and 2nd City.How Can i do this.
Thanks

What you need to do first is give a little more information.
We need your current table or query and the manner of splitting you require (Is it on each comma (,) etc).

Please post the MetaData (Name of table and Fields + Type of Fields) for tables and/or the SQL for queries.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#3: Dec 11 '06

re: Want to break a column text in two column


Quote:

Originally Posted by ajaygiri786

Dear friends,
I have a problem.I want to break a column in which Address text is written, into two other column for Ist adrress and 2nd City.How Can i do this.
Thanks

If the column has a comma separating the two values then it's not too difficult.
You need to run the following query.

Expand|Select|Wrap|Line Numbers
  1. UPDATE TableName SET [1st address]=Left([Address], InStr([Address], ",")-1), [2nd City]=Right([Address], InStr([Address], ",")+2)
  2.  
Mary
Newbie
 
Join Date: Dec 2006
Posts: 2
#4: Dec 12 '06

re: Want to break a column text in two column


Hi
I want to say that there is no comma in the text, text are seperated by space only. once again i told u---suppose it is the text in the column
C-43 Teacher Colony Deoband
i want to break the above example so that the first part C-43 should be in one column and Teacher Colony in 2nd column and Deoband should be in third column.
Plz help me.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,706
#5: Dec 12 '06

re: Want to break a column text in two column


I cannot help much here as the MetaData is still unavailable.
However, I guess that you're talking about imorting text into the database rather than processing records already imported.
If you go through the Import Wizard (File / Get External Data / Import...) then there is an option to import as delimited.
Use this and set the delimiter to space.
msquared's Avatar
Administrator
 
Join Date: Aug 2006
Location: Dublin, Ireland
Posts: 10,865
#6: Dec 12 '06

re: Want to break a column text in two column


Quote:

Originally Posted by NeoPa

I cannot help much here as the MetaData is still unavailable.
However, I guess that you're talking about imorting text into the database rather than processing records already imported.
If you go through the Import Wizard (File / Get External Data / Import...) then there is an option to import as delimited.
Use this and set the delimiter to space.

Also if the text file is set to fixed size fields you can import it as a fixed length text file.

Mary
Reply