views:

28

answers:

1

I am looking to replace values in a particular column. For example the following column values

column name
----------
Test1
Test2
Test3
Test12
Test14

should be (replacing est1 with rest1)

column name
----------
Trest1
Test2
Test3
Trest12
Trest14

I know this should be simple but not able to get the exact function. Any help is appreciated.

+6  A: 

Use REPLACE:

SELECT REPLACE(t.column, 'est1', 'rest1')
  FROM TABLE t

If you want to update the values in the table, use:

UPDATE TABLE
   SET column = REPLACE(t.column, 'est1', 'rest1')
OMG Ponies
That was quick. Thanks.
schar