Hi @Naomi
In my opinion,it's not correct.
First, dbo.RemoveSpecialChars
may be a UDF which is uesd to remove specified strings as the name suggests.
Second,NULLIF function returns the first expression if the two expressions are not equal. If the expressions are equal, NULLIF returns a null value of the type of the first expression.
So the code can be re-written as :
CASE WHEN dbo.RemoveSpecialChars(LTRIM(RTRIM(mcpsl.facility_state_cd)))
<>
LEFT(dbo.RemoveSpecialChars(LTRIM(RTRIM(mcpsl.facility_zip_code_nbr))), 5)
THEN ...
Best regards,
LiHong