skip to Main Content

How do I remove square brackets and commas from ["000-000-0000-000","000-000-0000-000","000-000-0000-000"] in sql amazonredshift

I tried ltrim it didn’t work. It prompted me to use cast function. Not sure how should I use cast function here.

2

Answers


  1. In order to remove square brackets and commas from the given string, REGEXP_REPLACE function can be used. Try this command;

    SELECT REGEXP_REPLACE(your_column_name, '[[],]', '', 'g') AS modified_column
    FROM your_table_name;
    

    Hope it works 🙂

    Login or Signup to reply.
  2. Use the below script.
    SELECT REPLACE(REPLACE(‘[ "000-000-0000-000","000-000-0000-000","000-000-0000-000" ]’, ‘[‘, ”), ‘]’, ”);

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search