I have some address data that needs parsing. Most of the address information is suitable for me, except for gender data.
For gender data, I get different ways, I can get the following formats:
"123 Main Street Floor 2" OR "123 Main Street 2nd Floor"
If I use the case ... when the instruction is to analyze my data, how can I determine when to get the number after or the number earlier? Ultimately, I want, for example, "Floor 2", for example, 1 and "2nd floor", for example 2.
This is the sql that I am currently using.
CASE WHEN (addr LIKE 'floor%' and addr LIKE '%[0-9]%' ) THEN SUBSTRING(addr, CHARINDEX('Floor ', addr),
LEN(addr))
source
share