SQL Server String Concatenation Guide

In SQL Server, you can use the + operator to concatenate strings. Below is an example of concatenating strings using the + operator.

DECLARE @str1 VARCHAR(50) = 'Hello';
DECLARE @str2 VARCHAR(50) = 'World';

DECLARE @result VARCHAR(100);

SET @result = @str1 + ' ' + @str2;

SELECT @result;

The output result is “Hello World”. In the above example, the @str1, space and @str2 are concatenated together using the + operator, and the result is stored in the @result variable.

bannerAds