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
 Development Tools
 Other Development Tools
 Separating Text String into Fields

Author  Topic 

tecknowledge1164
Starting Member

25 Posts

Posted - 2007-08-24 : 18:44:57
I am involved in doing a data conversion from a delimited text file into a SQLExpress database using vb.net 2005. One of the fields in my source file strings City, State and Zip into one field. I need to be able to separate them into the three fields. It appears that they were originally entered as freely typed text, so there are some inconsistencies in the way it is stored. Mostly it is the number of spaces between state and zip. If that were consistent it would be fairly easy to figure out. I have seen records with about six spaces between the state and zip, while most have only one. I thought about just replacing all the spaces and counting the number of characters from the right to identify the state and zip, (allowing for "-" five characters to the right to indicate a zip extension), but some city names have embedded spaces in them.

If anyone can suggest a way to work with this I would appreciate it. Thanks.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-25 : 03:55:06
Search for fnParseString function in the LIBRARY section of this forum.
It will help you. It has examples too!



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -