Udostępnij za pośrednictwem


String Concatenation Operator (Transact-SQL)

The plus sign (+) is the string concatenation operator that enables string concatenation. All other string manipulation is handled by using string functions such as SUBSTRING.

By default, an empty string is interpreted as an empty string in INSERT or assignment statements on data of the varchar data type. In concatenating data of the varchar, char, or text data types, the empty string is interpreted as an empty string. For example, 'abc' + '' + 'def' is stored as 'abcdef'. However, if the compatibility level setting is 65, empty constants are treated as a single blank character and 'abc' + '' + 'def' is stored as 'abc def'. For more information about setting compatibility levels and interpreting empty strings, see sp_dbcmptlevel (Transact-SQL).

When two character strings are concatenated, the collation of the result expression is set following the rules of collation precedence. For more information, see Collation Precedence (Transact-SQL).

See Also

Reference

Operators (Transact-SQL)

Other Resources

String Concatenation Operator (Database Engine)

Help and Information

Getting SQL Server 2005 Assistance