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.
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
In order to remove square brackets and commas from the given string, REGEXP_REPLACE function can be used. Try this command;
Hope it works 🙂
Use the below script.
SELECT REPLACE(REPLACE(‘[ "000-000-0000-000","000-000-0000-000","000-000-0000-000" ]’, ‘[‘, ”), ‘]’, ”);