String Function – CONCAT()

I am going to continue my series of very short articles or tidbits on Transaction SQL string functions. I will exploring the CONCAT() function today.

The CONCAT() function takes two or more string arguments and combines them into one string. Any arguements that are not strings are converted to a string. All NULL values are converted to the empty string ‘ ‘.

The following example takes seven input arguements of various data types and returns one string output.

One thing to always worry about when using TSQL functions is how will it react with a UNKNOWN or NULL values?

In the example below, two NULL values equal one empty string.

Next time, I will be exploring the DIFFERENCE() function.

Related posts

Leave a Comment