With SQL Server 2012 Microsoft has introduced two new string functions, bringing the total to 25. String functions perform an operation on a string value that you input, returning another string (or sometimes numeric) value. They are also referred to as scalar functions, which mean they operate on a single value and return just a single value.
New to 2012 are the CONCAT()
and FORMAT()
functions. Let us take a look at what they do and explore some real world examples of how you might use them in your day to day T-SQL programming.
As you might have already guessed, the job of CONCAT
is to perform a concatenation operation. Pass CONCAT
a number of string arguments and it will concatenate, or join them together and return an output string.
The basic structure is as follows:
CONCAT ( string_value_1, string_value_1 [, string_value_n ] )
Now if you are thinking, "Is this really of any use? Surely I can do that already using the concatenation operator?", then hold tight; there...