how to replace non ascii charactes with empty in postgres RRS feed

  • Question

  • Hi 
     I have one doubt in postgresql, how to replace non ascii character with empty values in postgresql
    table :Emp
    Āddī Ārkʿay

    based on above data i wantoutput like below 

    I tried like below 
    SELECT replace(addres,'%[^a-Z0-9, ]%',' ')
    FROM emp
    WHERE address like '%[^a-Z0-9, ]%'
    select   replace(addres,'^[^[:ascii:]]',' ') from  emp where  address ~ '^[^[:ascii:]]' 

    above two queris are not giving expected result
    can you please tell me how to write query to replace for non ascci chareater with empty values in postgresql

    Wednesday, April 24, 2019 3:13 AM

All replies

  • Hi BalaKrishna,

    Thank for your feedback. I believe this cannot be handled with single command. You need create a function to take care of this.

    Could you please refer below StackOverFlow threads. I believe these might help you.



    Hope it helps.

    • Proposed as answer by angoyal-msft Wednesday, April 24, 2019 6:23 AM
    Wednesday, April 24, 2019 6:23 AM
  • Hi BalaKrishna

    I hope the information provided for your concern is helpful. Please "Mark as answer" if it was helpful, so that it can help the other users with same problem.

    If you need more information, please let us know.

    Friday, April 26, 2019 8:10 AM