I am trying to replace all null values in my query with \'\' as our interface won\'t accept NULL as an entry. Ive run into a piece of my code where im using the REPLACE functi
You can use the isnull
function to replace null values:
replace(isnull(clients.CLIENT_ID_2, ''),'-','') as PatientSSN
The coalesce
function can also be used in the same way. The only difference between isnull
and coalesce
is that isnull
is specially intended to replace a null value so it only takes two parameter.
You can also use a case
, then it would be:
case
when clients.client_id_2 is null then ''
else replace(clients.CLIENT_ID_2,'-','')
end as PatientSSN,