Im trying to go through an SQL db of stores and, in the address field, remove everything but the first line BEFORE the <br /> so its only the street number and street name left in the address field...
So, for example, the address field for record 1 after editing would be:
77 Whatever Rd
BUT
I want to take the zip code, which is the last 5 characters in the address field text string, and move that to a new column called 'zip' in the same table.
Suggestions? Flex those SQL muscles developers...
EDIT: I got the columns duplicated. I now have the address column and a new column called 'zip' with the same contents.
If anyone can generate the regex expression to select the first line of an address text and another expression to select the last 5 characters of an address text, thatd be a big part of the equation.
77 Whatever Rd<br />
[26 spaces are right here]Balls<br />
[26 spaces are right here]Alabama<br />
[26 spaces are right here]87891
(so expression 1 would select 77 Whatever Rd)
(and expression 2 would select 87891)
I think expression 2 would be:
[(26 spaces right here, no parentheses)][1-9][0-9]{4}

So, for example, the address field for record 1 after editing would be:
77 Whatever Rd
BUT
I want to take the zip code, which is the last 5 characters in the address field text string, and move that to a new column called 'zip' in the same table.
Suggestions? Flex those SQL muscles developers...
EDIT: I got the columns duplicated. I now have the address column and a new column called 'zip' with the same contents.
If anyone can generate the regex expression to select the first line of an address text and another expression to select the last 5 characters of an address text, thatd be a big part of the equation.
77 Whatever Rd<br />
[26 spaces are right here]Balls<br />
[26 spaces are right here]Alabama<br />
[26 spaces are right here]87891
(so expression 1 would select 77 Whatever Rd)
(and expression 2 would select 87891)
I think expression 2 would be:
[(26 spaces right here, no parentheses)][1-9][0-9]{4}