Search

Tuesday, September 6, 2011

SQL Server Denali: CONCAT() Function


CONCAT() Function is new string function in SQL Server Denali. It returns a string that is the result of concatenating two or more string values (or values that can be converted to string).
Syntax: CONCAT(string1, string2, string3, ...)  
With CONCAT function, you can concatenate between 2 and 254 values. If you try to use CONCAT with only one value or with more than 254 values you will get an error.

Example:
select concat ('First' , ' ' ,'Second',' ','Three')
It will return "First Second Third"

CONCAT function has 2 advantages compared to the concatenating of strings using the “+” operator:
1. NULL values are implicitly converted to an empty string
2. All arguments are implicitly converted to string

1 comment:

  1. I wanted to thank you for this excellent read!! I absolutely loved every bit of it.
    I have got you bookmarked to check out new stuff you post…
    Also visit my webpage :: Hostwinds

    ReplyDelete