Topic
  • 1 reply
  • Latest Post - ‏2012-03-07T12:25:20Z by SystemAdmin
LKMA
LKMA
3 Posts

Pinned topic 'Replace' syntax

‏2012-03-07T07:53:00Z |
What is the proper syntax for replacing characters?
My replace statement:

Select replace(note,’old’,’new’) from history

So I am trying to update instances of 'old' to 'new' in the note column of the history table.

The result: The updated text is displayed as I would it expect but the change is not committed so the actual update doesn't happen.
Updated on 2012-03-07T12:25:20Z at 2012-03-07T12:25:20Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    1143 Posts

    Re: 'Replace' syntax

    ‏2012-03-07T12:25:20Z  
    If you want to update column, you should use UPDATE statement IMHO.
    e.g.
    UPDATE history SET note=replace(note,’old’,’new’)
    -- WHERE ....if you do not want to update all fields put restriction here
    ;
    HTH
    Hrvoje