Case Function with Is Null
How Do I Implement Such Scenario in Teradata If Col1 Is Null or If Col1 = ''Jack'' Then Col2 Else Col1 I Ha E Implemented It but for Some Reason It's Not...
How do I implement such scenario in Teradata
If Col1 is null or if Col1 = ''Jack'' then Col2 else Col1
I ha e implemented it but for some reason it's not working may be some issue with Bracketay
2 Answers
You can also use the NULLIF() operator:
COALESCE(NULLIF(col1,'Jack'), col2)
This is logically equivalent to the CASE statement in the previous answer.
You can use a case expression:
case
when col1 is null or col1 = 'Jack' then col2
else col1
end
String (varchar) constants need to be enclosed in sinqle quotes in SQL.