NULL as replacer in Replace function
Posted on 2003-10-29
I have created the following function:
CREATE FUNCTION ISEQUAL(@equal_a varchar(4000), @equal_b varchar(4000))
IF @equal_a = @equal_b
Basically, this function just checks to see if two values are equal and returns a one or zero. What I am trying to accomplish, is this statement:
SELECT ISNULL(REPLACE(dbo.ISEQUAL(@somevalue,@anothervalue), 0, NULL), @bettervalue);
The only problem is that, no matter what REPLACE(dbo.ISEQUAL(@somevalue,@anothervalue), 0, NULL) will ALWAYS return NULL. Why is this if there are no null comparisons? All It's doing is replacing the found value with a NULL if it finds it. Also, what is a workaround for this?