Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Splitting a field

Author  Topic 

robertnzana
Starting Member

42 Posts

Posted - 2008-05-20 : 12:13:35
I imported data into a table. It has City/State together, like this "Miami, FL". How can I "split" the 2 fields and put Miami into the City field and FL into the state field (in the same table)?

Thanks.

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-05-21 : 05:46:16

select mid(column_name, 1,instr(1,column_name)-1),mid(column_name, instr(1,column_name,',')+1,len(column_name)) from your_table

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -