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
 General SQL Server Forums
 New to SQL Server Programming
 String function

Author  Topic 

Scrappus
Starting Member

2 Posts

Posted - 2011-06-04 : 16:52:27
I have a question… does anybody know the code that would parse a compound address field’s data into a new table?

Table#1 – 1 column hold’s exiting data that will always look like this:
Col# 1: 3208 VENTANA HILL DR, LAS VEGAS, 89117
Copied into Table#2:
Column# 0 – 4
Street Number,
Street Name,
City,
Zip
? thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-06-05 : 03:36:15
is the individual parts always separated by comma? also are there always a maximum of four parts alone for an address? if yes, make use of PARSENAME function

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2011-06-07 : 07:24:04
Search for Split function in this forum

Madhivanan

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

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2011-06-07 : 08:59:05
Or this fancy article

http://www.sqlservercentral.com/articles/Tally+Table/72993/

Corey

I Has Returned!!
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-06-07 : 09:03:29
If it is too fancy, just skip all the gory details and go on to Fig 21 in that article which has the script for the split function.

Ok, ok, "gory" may have been too harsh a word, but you know what I mean...
Go to Top of Page

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2011-06-07 : 09:09:20
I have to say... i thoroughly enjoyed reading that a couple of weeks ago...

Sad... I know.

Corey

I Has Returned!!
Go to Top of Page
   

- Advertisement -