Answer: As the name suggests, it concatenates strings. In earlier versions of Sql Server we have the option of performing concatenation using the '+' symbol. But the overhead was that if the types that are participating in the concatenation are not of varchar type, then we had to do explicit conversion else it was resulting in error. However, the new Concat() function takes care of this explicit conversion.
e.g.
Select Concat('Sql',12, Null, 'Code Name', ' Denali') As [MultipleField Concat]
/* Output
MultipleField Concat
---------------------
Sql12Code Name Denali
*/
Asked In: Many Interviews |
Alert Moderator