CONCAT (TSQL Function)

Returns the concatenation of two or more strings, replacing NULL values by empty strings.


CONCAT ( string_value1 , string_value2 [, ...string_valueN] )


is a string to concatenate with the others. It is of type varchar.

Return Types

Returns varchar.

The collation of the returned string is the combination of the collations of all arguments. An error is raised if collations are not compatible.


CONCAT takes all string arguments and concatenates them.

At least two strings must be passed; else, an error is raised.

NULL values are replaced by empty strings.


PRINT CONCAT('Mozart was born on ', 27, ' January ', 1756);

The result is:

Mozart was born on 27 January 1756

Another example:

PRINT CONCAT(10, 20, 30, 'Hello', NULL, 'World');

The result is:


Incompatible collations:

PRINT CONCAT('asdf' COLLATE en_cs_as, 'asdf' COLLATE en_ci_ai)

The result is:

<Syntax error. Cannot resolve conflict between en_ci_ai and en_cs_as collations.>