This query works in mysql but I am not sure how to write the same query in redshift / postgresql.
update customer_Details set
customer_No = NULL
WHERE customer_No NOT REGEXP '^[[:digit:]]{12}$'
This query works in mysql but I am not sure how to write the same query in redshift / postgresql.
update customer_Details set
customer_No = NULL
WHERE customer_No NOT REGEXP '^[[:digit:]]{12}$'
You need to use !~ operator. Something like this should work:
UPDATE
customer_details
SET
customer_no = NULL
WHERE
customer_No !~ '^[[:digit:]]{12}$';
Redshift is basically a fork of postgres 8.3, and it uses postgres's regex syntax:
update customer_Details set
customer_No = NULL
WHERE customer_No ! ~ '^[0-9]{12}$'