SQL Server Denali New Function – CONCAT

Leave a comment (0) Go to comments

CONCAT – SQL Server String concatenation function

CONCAT is new function introduced in SQL Server Denali (2012) CTP3. This function is same as Microsoft excel and returns a string that is the result of concatenating two or more string values

This function minimum requires two input values to concatenate the string.

-- SQL Server CONCAT Example
SELECT CONCAT ( 'SQL Server Denali', 'CTP 3', 'Tutorials' ) AS Result;

Here is the result of above query

Result
-------------------------
SQL Server Denali CTP 3 Tutorials

(1 row(s) affected)

Note:


  • All arguments to CONCAT() functions are implicitly converted to string type, when using ‘+‘ you need to use either CAST() or CONVERT() to convert into string type.
  • NULLs are converted to empty string, that means if you are concatenating three columns and if you have null value in one column that that will be replaced by a empty string.

More Details can be found at Microsoft BOL.

EOF - SQL Server Denali New Function – CONCAT, SQL Server 2012 , 2008 R2 , 2008 , 2005 , 2000

Leave a Reply

Your email address will not be published. Required fields are marked *


*


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.