Sybase replace function

user841293 picture user841293 · Feb 13, 2015 · Viewed 10.3k times · Source

I am unable to use sybase replace function to replace data. Basically what i need is to update all the occurrences of 'abc' and change with 'zzz'.] table_clmn is data type text I am using the following sql --

update  table
set table_clmn = replace(table_clmn , 'abc', 'zzz') WHere id in (1, 2)

I get the following error

Incorrect syntax near the keyword 'replace'.

Answer

RobV picture RobV · Feb 14, 2015

Assuming you're using Sybase ASE, you need to use the built-in function 'str_replace()' instead of 'replace()'. The 'replace' function can only be used for changing the default constraint on a table column.