CONCAT() fucntion is introduced in SQL Server 2012. Before to this version, concatenation of two strings is to be done by using
+ ( plus) operator.
Syntax:
CONCAT ( string1, string2[, string-n]) Example:
SELECT CONCAT( 'FirstName', ' ', 'LastName' ) FullName
Output
FullName
-------------------
FirstName LastName
There are some differences between Plus operator's concatenation and CONCAT function...
The equivalent SQL for the above SELECT using Plus operator is as follows:
SELECT 'FirstName' + ' ' + 'LastName' as FullName
Usage: Mainly used to generate comma separated values of all or some of the columns in a table
Example,
SELECT Conact(EmpID , ' ,', FirstName, ' , ' , LastName, ' , ', Salary) CSVData
FROM EMPLOYEETable