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 |
|
PatDeV
Posting Yak Master
197 Posts |
Posted - 2006-03-28 : 13:41:18
|
| hi all,I have field CSZ(city, state zip) like (Boston, PA 85985)how can i make it separate in three column for C, S, Zip!!thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
|
|
PatDeV
Posting Yak Master
197 Posts |
Posted - 2006-04-11 : 11:07:51
|
| is there a other way of doing this please!thanks |
 |
|
|
RyanRandall
Master Smack Fu Yak Hacker
1074 Posts |
Posted - 2006-04-11 : 11:30:46
|
Hi Pat,Can't you just use some standard string manipulation functions? I'm not that familiar with the csz format, but something like this should get you started...--datadeclare @t table (csz varchar(60))insert @t (csz) values ('Boston, PA 85985')--calculationselect left(csz, charindex(',', csz)-1) as city, left(right(csz, charindex(' ', reverse(csz))+2), 2) as state, right(csz, charindex(' ', reverse(csz))-1) as zipfrom @tRyan Randallwww.monsoonmalabar.com London-based IT consultancy Solutions are easy. Understanding the problem, now, that's the hard part. |
 |
|
|
|
|
|
|
|