CONCAT combines multiple values into one string that can be compared with a corresponding combined value.
Legacy systems sometimes store a business identifier in separate fields while another system stores it as one value.
Match records using BranchCode and AccountNumber combined into a single reference.
SELECT
a.AccountNumber,
r.ReferenceValue
FROM Accounts a
INNER JOIN ExternalReferences r
ON CONCAT(a.BranchCode, '-', a.AccountNumber)
= r.ReferenceValue;
Used in legacy integration, migration, reconciliation, and cross-system matching.
- CONCAT combines values into a string.
- Separators can prevent ambiguous combinations.
- Data type conversion may be required.
- Expression-based JOINs can affect performance.
- A standardized key is preferable when possible.
Why use CONCAT in a JOIN?
It can match a combined business key against a value stored as one string.
Why use a separator in CONCAT?
A separator can reduce ambiguity between combinations of values.