Concat TSQL Tutorial

Concat function

Concat Example 1:

SELECT CONCAT ('Daniel', ' - ','Scott') AS FullName;
Result: Daniel - Scott

Concat Example 2:

Cities table:

CITY_IDNAMESTATE
1New YorkNew York
2Los AngelesCalifornia
3ChicagoIllinois
4San AntonioTexas
5San DiegoCalifornia

SELECT CONCAT (city_id, ' / ', name, ' / ', state) AS Result FROM cities WHERE state='California';

Concat Result:

Result
2 / Los Angeles / California
5 / San Diego / California

See also: T-SQL Functions -> Charindex -> Left -> Len -> Lower -> Ltrim