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.
| Author |
Topic |
|
amsqlguy
Yak Posting Veteran
89 Posts |
Posted - 2008-09-09 : 10:01:51
|
| I have data inconsistent format for state and zip code what is the best way to parse the zip codeDC 20170 (1 space between state and zipcode)ND 01708 (2 space between state and zipcode)SC 18178 (3 space between state and zipcode)Any suggestions and inputs would help.Thanks |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-09-09 : 10:06:09
|
quote: Originally posted by amsqlguy I have data inconsistent format for state and zip code what is the best way to parse the zip codeDC 20170 (1 space between state and zipcode)ND 01708 (2 space between state and zipcode)SC 18178 (3 space between state and zipcode)Any suggestions and inputs would help.Thanks
Do you want to extract numbers or want to keep only one space?MadhivananFailing to plan is Planning to fail |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-09-09 : 10:12:05
|
SELECT LEFT(ZipCode, 2) + ' ' + RIGHT(ZipCode, 5)FROM Table1 E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|