none
Replace special character RRS feed

  • Question

  • Hi

    How can I replace this "History0"/ "History1" from below string. I tried all ways, but unable to replace that string.

    Does anyone worked on this type of string.


    Royal Thomas

    Monday, October 21, 2019 4:40 AM

Answers

  • Hi ,

    Thank you for your posting,

     

    Could you  please share us your table structure (CREATE TABLE …) and some sample data (INSERT INTO…) along with your expected result? So that we’ll get a right direction and make some test.

    Please try following script and refer to REPLACE (Transact-SQL).

    IF OBJECT_ID('test') IS NOT NULL drop table  test   
    go 
    create table test (
    Details varchar(30)
    )
    insert into test values 
    ('History0:save '),('History1 : detail')
    
    select  replace(replace(Details,'History0','yourwords'),'History1','yourwords')  
    from test 
    /*
    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    yourwords:save 
    yourwords : detail
    */

    I find that in your simple data you might have special string . Please check it.

     

    Best Regards,

    Rachel


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Marked as answer by Royal Thomas Monday, October 21, 2019 7:48 PM
    Monday, October 21, 2019 5:51 AM