I want to surround the selected column entries with double quotes whenever there is a special character say ' | ' in the column value .
select
case
when (p.email_address_text like '%|%')
then 'true' -- where i want to surround the entry with double quotes
else p.email
end as email
from dev_databse..tmp_new_student p where p.email_address_text like '%[email protected]%';
In the above query in the true condition I want to surround email by double quotes whenever email contains | . For ex if email is a|[email protected] , I want it to be "a|[email protected]". Is it possible to do that ?