Replaces a string with another string, and returns the new results.
REPLACE( original-string, search-string, replace-string )
If any argument is NULL, the function returns NULL.
original-string The string to be searched. This can be any length.
search-string The string to be searched for and replaced with replace-string. This string is limited to 255 bytes. If search-string is an empty string, the original string is returned unchanged.
replace-string The replacement string, which replaces search-string. This can be any length. If replacement-string is an empty string, all occurrences of search-string are deleted.
LONG VARCHAR
LONG NVARCHAR
This function replaces all occurrences.
Comparisons are case-sensitive on case-sensitive databases.
SQL/2003 Vendor extension.
The following statement returns the value xx.def.xx.ghi.
SELECT REPLACE( 'abc.def.abc.ghi', 'abc', 'xx' ); |
The following statement generates a result set containing ALTER PROCEDURE statements which, when executed, would repair stored procedures that reference a table that has been renamed. (To be useful, the table name must be unique.)
SELECT REPLACE( REPLACE( proc_defn, 'OldTableName', 'NewTableName' ), 'CREATE PROCEDURE', 'ALTER PROCEDURE') FROM SYS.SYSPROCEDURE WHERE proc_defn LIKE '%OldTableName%'; |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |