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
 Splitting an address string

Author  Topic 

Scrappus
Starting Member

2 Posts

Posted - 2011-06-04 : 18:49:02
I am new to SQL… please, does anybody know how to separate an address field in 1 table into 4 columns... street number, street name, city, zip, in a different table?

A sample record looks always like this:
1112 STONEYPEAK DR, NORTH LAS VEGAS, 89081

1st table:

SELECT [ID]
,[Property Location]
,[Auction Date]
,[Sale Location]

FROM NVLegNews-1

2nd table:

SELECT [ID]
,[Street#]
,[Street]
,[City]
,[Zip]
,[State]
,[Agent:]
,[Zone:]
,[Photo Name:]
,[Comp:]
,[Estimated Bid]
,[Current Bid:]
,[Max Bid:]
,[Note-1:]
FROM [Properties]

thanks

engcanada
Starting Member

39 Posts

Posted - 2011-06-04 : 22:57:03
Use a Split function(http://wap.w3schools.com/vbscript/func_split.asp) and then insert them seperatly into a new or an existing table.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-06-05 : 03:36:54
same as http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=161407

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

Go to Top of Page
   

- Advertisement -