john.arnott (7/12/2010)
kevin.l.williams (7/12/2010)
Anyone got any ideas why this function was made to work this way? Makes no sense to me.I cannot answer that authoritatively, but consider that it would make no sense to try to replace part of a string with NULL either, so perhaps the decision was made to check the types of all three parameters first before doing the matching.
--
edit: fix typo
I guess my question is why does the REPLACE function replace anything if the string pattern (second parameter) isn't in the string expression (first parameter)?
For example, this doesn't return 'bbb':
SELECT REPLACE('Hello world', 'zzz', 'bbb');
So why should
SELECT REPLACE('Hello world', 'zzz', NULL);
return NULL?
Thanks in advance for any help,
webrunner
-------------------
A SQL query walks into a bar and sees two tables. He walks up to them and asks, "Can I join you?"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html