September 10, 2003 at 1:44 pm
Has anyone else come across this? I found a REPLACE command that wasn't working as it should, or at least as I expected it should. In the following command: SELECT REPLACE('ken@domain.com', 'ken@domain.com', 'test@test.com') The output replaces the text, as it should. Now: SELECT REPLACE('ken@domain.com', 'watermelon@farm.com', 'test@test.com') gives the expected output of 'ken@domain.com'.
Okay. Two more. SELECT REPLACE('ken@domain.com', 'ken@domain.com', NULL) gives the expected output of NULL. Why does SELECT REPLACE('ken@domain.com', 'watermelon@farm.com', NULL) give NULL as the output, when it should be 'ken@domain.com'?
I've since used a more suitable CASE statement to do this, but I just wanted to bring it to anyone's attention.
-Ken
September 10, 2003 at 2:30 pm
I'd guess that they use an internal variable and concatenate the results - since nulls propagate, you wind up with null.
Andy
September 10, 2003 at 3:18 pm
Yea, I figured the underlying MS supplied function isn't handling the nulls properly. This one caught me off guard- Where are the emaill addresses? Some outputs I'd written had all NULL email addresses.
-Ken
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply