I have a sql statement which needs to be modified. It combines several fields or any combination may or may not be null. I need one space between each value when it exists. I was wondering if using case for this might be the best approach.
select action,quantity,
Ltrim((isnull(ACTION,'')+ ' '+ isnull(QUANTITY,'') + ' '+ isnull(UNITOFMEASURE,'') +
' ' + isnull(ROUTE,'') + ' ' + isnull(FREQUENCY,'') + ' ' + isnull(SYMPTOM,'') + ' ' + isnull(ADDITIONALSIGNETUR,''))) as sig
from medicationorder