CONCAT in Teradata



CONCAT function/command is used to join/concatenate two or more inputs supplied to it.

Input: strings, number
Output: Concatenated output.

Syntax:
SELECT CONCAT('string1' or number1,'string2' or number2)

Example:
SELECT CONCAT('Tera','data')

Result: Teradata


Note:
CONCAT command can be used for both strings and numbers for ā€˜nā€™ number of inputs.
If you give numbers for CONCAT it will do its operation but with spaces.
CONCAT will apply two spaces internally before the number wherever it appears.
It is advised to use CONCAT command with numbers carefully since it generates the spaces between the numbers.
The best option here is to convert the numbers to string and doing the operation.

Specialty of CONCAT command:
It will accept ā€˜nā€™ number of inputs(strings,numbers).

Few ForgetCode Examples:

SELECT CONCAT('Tera','data',11) 

Teradata  11   //(Spaces are there in the output)


SELECT CONCAT(7777,999,11) 

Teradata  7777   999  11   //(Spaces are there in the output)



SELECT CONCAT('7777','999','11') 

Teradata  777799911   //(Numbers are represented here in string format)




..