Let's start off with concatenation, or the joining of two or more strings. Remember, "string" is another name for "text value".
First, we'll need a new operator,
+. This plus sign is the concatenation operator. If you write the following:
FirstName + LastName AS Name
The result for
FirstName = N'Kate' and
LastName = N'Gordon' will be
N'KateGordon'. Notice that the result is a single string.
Quite simple, right? Of course, we probably want the first and the last name separated with a space. Here is how you do that:
FirstName + N' ' + LastName AS Name
Note that you use single quotes for constant text values (in our example, the constant value is a space,
' ') plus the letter
N to indicate that it has UNICODE encoding. You don't use quotes for column names (
+ operator can be used many times in a single query.