Saturday 11 February 2023

Search and Replace function DB2 SQL

A function to replace all occurrences of a string in a source string with a new string.

  • Using Db2 REPLACE() function with literal string example
REPLACE(source_string, search_string, replace_string )

SELECT 

    REPLACE('IBM DB2','DB2','Db2') result

FROM 

    sysibm.sysdummy1;

RESULT :  IBM Db2