33-34 Fix phone format

This commit is contained in:
Mathieu Jaumotte 2023-03-08 21:04:09 +01:00
parent f3170d0c87
commit 838bcb78ff

View File

@ -211,13 +211,13 @@ UPDATE import.periodes SET intensity1='occasional'; UPDATE import.periodes SET i
ALTER TABLE import.personnes ADD column mobilenumber1 text; ALTER TABLE import.personnes ADD column mobilenumber1 text;
UPDATE import.personnes SET mobilenumber1=NULLIF(regexp_replace(mobilenumber, '[^0-9]', '', 'g'), ''); -- remove all NaN chars UPDATE import.personnes SET mobilenumber1=NULLIF(regexp_replace(mobilenumber, '[^0-9]', '', 'g'), ''); -- remove all NaN chars
UPDATE import.personnes SET mobilenumber1=regexp_replace(mobilenumber1, '^0', '') WHERE mobilenumber1 like '0%'; -- remove first 0 prefix UPDATE import.personnes SET mobilenumber1=regexp_replace(mobilenumber1, '^0', '') WHERE mobilenumber1 like '0%'; -- remove first 0 prefix
-- UPDATE import.personnes SET mobilenumber1=regexp_replace(mobilenumber1, '(.*)', '+32\1'); -- add belgium intl prefix UPDATE import.personnes SET mobilenumber1=regexp_replace(mobilenumber1, '(.*)', '+32\1'); -- add belgium intl prefix
-- 34. Format phone numbers -- 34. Format phone numbers
ALTER TABLE import.personnes ADD column phonenumber1 text; ALTER TABLE import.personnes ADD column phonenumber1 text;
UPDATE import.personnes SET phonenumber1=NULLIF(regexp_replace(phonenumber, '[^0-9]', '', 'g'), ''); -- remove all NaN chars UPDATE import.personnes SET phonenumber1=NULLIF(regexp_replace(phonenumber, '[^0-9]', '', 'g'), ''); -- remove all NaN chars
UPDATE import.personnes SET phonenumber1=regexp_replace(phonenumber1, '^0', '') WHERE phonenumber1 like '0%'; -- remove first 0 prefix UPDATE import.personnes SET phonenumber1=regexp_replace(phonenumber1, '^0', '') WHERE phonenumber1 like '0%'; -- remove first 0 prefix
-- UPDATE import.personnes SET phonenumber1=regexp_replace(phonenumber1, '(.*)', '+32\1'); -- add belgium intl prefix UPDATE import.personnes SET phonenumber1=regexp_replace(phonenumber1, '(.*)', '+32\1'); -- add belgium intl prefix
-- SELECT mobilenumber, mobilenumber1, phonenumber, phonenumber1 FROM import.personnes; -- SELECT mobilenumber, mobilenumber1, phonenumber, phonenumber1 FROM import.personnes;