Share via

ADF - concat null values

Ulrike Pick 40 Reputation points
2025-10-28T13:42:07.1833333+00:00

Hi,

I need help with concatenating 2 string columns, one of which may be empty (null).
The concat function returns NULL if one of the input values is NULL - though I don't find that in the docs.

Do I have to replace all NULL strings with - what?
Or is there a simpler way? (keeping in mind that every additional string operation comes with performance consts).

Thanks in advance!

Best, Ulrike

Azure Data Factory
Azure Data Factory

An Azure service for ingesting, preparing, and transforming data at scale.

0 comments No comments

Answer accepted by question author

Amira Bedhiafi 42,941 Reputation points MVP Volunteer Moderator
2025-10-28T18:08:01.03+00:00

Hello !

Thank you for posting on Microsoft Learn Q&A.

In mapping data flows concat() returns NULL if any input is NULL. You don’t need to prefill your column in the source just null proof the concat at runtime.

Try :

concat( coalesce(col1, ''), coalesce(col2, '') )

or :

concatWs(' - ', col1, col2)

or :

iif( isNull(col1) && isNull(col2),
     NULL(),
     concat(coalesce(col1,''), coalesce(col2,''))
)

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.