CONCAT
Updated: 30 April 2009.
Use CONCAT function to concatenate the contents of 2 columns.
Syntax
SELECT [wctString].[wct].[CONCAT] (
<@Text1, nvarchar(max),>
,<@Joiner, nvarchar(max),>
,<@Text2, nvarchar(max),>)
Arguments
@Text1
is the first text value to be concatenated. The @Text1 argument can be of data types that are implicitly convertible to nvarchar or ntext.
@Joiner
is the text value that connects @Text1 to @Text2. The @Joiner argument can be of data types that are implicitly convertible to nvarchar or ntext.
@Text2
is the second text value to be concatenate. The @Text2 argument can be of data types that are implicitly convertible to nvarchar or ntext.
Return Types
nvarchar(max)
Remarks
· CONCAT automatically converts input values to strings.
· CONCAT can be called iteratively to build up longer strongs
Examples
select 123 + '' + 456
This produces the following result
-----------
579
(1 row(s) affected)
select wct.concat(123,'',456)
This produces the following result
-----------
123456