none
Remove quote ( ' ) string? RRS feed

  • Question

  • Hi All,

    I have table with approx. 20 million records, of this table one column has string which included single_quote I need to replace with space, how can I do so?

    Here is the example:-

    Create Table #temp (id varchar(10), str varchar(50))
    
    
    
    Insert Into #temp Values ('AB78','Industry')
    
    Insert Into #temp Values ('AB79','Industry23')
    
    Insert Into #temp Values ('AB80','Industry56''Industry')
    
    Insert Into #temp Values ('AB81','Industry43Industry')
    
    Insert Into #temp Values ('AB82','Industry''Done')
    
    Insert Into #temp Values ('AB83','IndustryTruck')
    
    
    
    Select * 
    
    	From #temp
    
    
    
    Drop Table #temp




    AB78 Industry AB79 Industry23 AB80 Industry56'Industry AB81 Industry43Industry AB82 Industry'Done AB83 IndustryTruck
    But I was looking for output:-

    AB78	Industry
    
    AB79	Industry23
    
    AB80	Industry56 Industry
    
    AB81	Industry43Industry
    
    AB82	Industry Done
    
    AB83	IndustryTruck



    How can I proceed?

    Thanks


    regards,
    Kumar
    Friday, November 13, 2009 3:27 PM

Answers

  • use replace

    Select id , REPLACE(str , '''', ' ')
    From #temp
    

    Best Regards,
    Melissa Suciadi


    If you have found this post helpful, please click the 'Vote as Helpful ' link (the green triangle and number on the top-left).

    If this post answers your question, click the 'Mark As Answered ' link below. It helps others who experience the same issue in future to find the solution.

    • Marked as answer by gk1393 Friday, November 13, 2009 3:33 PM
    Friday, November 13, 2009 3:30 PM

All replies

  • use replace

    Select id , REPLACE(str , '''', ' ')
    From #temp
    

    Best Regards,
    Melissa Suciadi


    If you have found this post helpful, please click the 'Vote as Helpful ' link (the green triangle and number on the top-left).

    If this post answers your question, click the 'Mark As Answered ' link below. It helps others who experience the same issue in future to find the solution.

    • Marked as answer by gk1393 Friday, November 13, 2009 3:33 PM
    Friday, November 13, 2009 3:30 PM
  • Select id, replace(str, '''', '')
    From #temp
    

    every day is a school day
    Friday, November 13, 2009 3:33 PM
    Moderator