Transact-SQL (TSQL) Quick Tips – SQL CONCAT

In many cases I need to bring together two separate fields to create a new field.  Whether it be for display purposes, informational or joining to another table, the ability to combine two fields into one comes up frequently in my day-to-day work.

Starting with SQL Server 2012, a string function called CONCAT was introduced to handle this situation.  The SQL CONCAT function returns a string that is the result of concatenating two or more string values.

Syntax is simple:  CONCAT ( string_value1, string_value2 [, string_valueN ] )

The SQL CONCAT function requires between 2 and 254 arguments.

The following SQL Statements create a temp table with sample data and a few SQL statements to demonstrate the use of SQL CONCAT string function:


Here is what the query results look like:


Please modify the above SQL code to suit your needs!


Additional Content

Check out more examples by visiting my Home Page

Here you will find topics covering  Qlikview  SQL Server  Excel VBA


Leave a Comment