I need to do this on sql server
I have data such as
Belo Horizonte , MG - Brazil
São Paulo , SP - Brazil
Barueri , SP - Brazil
Ferraz de Vasconcelos , SP - Brazil
I need to select two letter words that match the pattern
Space Letter Letter
I tried this
SUBSTRING(ADDRESS_BLOCK,PatIndex('% [A-Z][A-Z] %',ADDRESS_BLOCK),3)
But I need to consider only capital letters for this (ie) output should be
MG SP SP SP
And do not include de, as shown in the last line of the exampleFerraz de Vasconcelos , SP - Brazil
Clear problem view
For example: vaishnava st northwind GH - The result should be GH
somersert PM vailash hj --Result has to be PM
source
share