2 years ago

#65919

test-img

veg2020

replace all special characters in column values of a SQL table

I have a column (in a SQL table) with several entries containing special characters (ampersand, comma, forward slash, dash, and parenthesis).

Is there a simple way to remove all these special characters (within the entries of <COLUMN_NAME> in below example) and replace with a underscore character?

This is what I am trying with no success unfortunately:

          SELECT MBR_ID, MONTH, 
                 REGEXP_REPLACE(COLUMN_NAME, '[/&-(,)()]+', '_') as COLUMN_NAME
          FROM TABLE_NAME

The error I am getting is: 'NoneType' object has no attribute 'cursor'.Appreciate any guidance here!

sql

snowflake-cloud-data-platform

special-characters

regexp-replace

0 Answers

Your Answer

Accepted video resources