SELECT knowledge FROM sql_resources WHERE category='bigquery-standard-sql' AND slug='concat'
CONCAT
Definition
The BigQuery CONCAT function allows you to combine (concatenate) one more values into a single result.
Alternatively, you can use the concatenation operator || to achieve the same output.
| full_names_by_function |
|---|
| Michael Scott |
| Pam Beesly |
| Kevin Malone |
Alternatively the same result could be achieved by:
CONCAT(value1[, ...])Practical Info
- All input values to the function or the operator must be
BYTESor a data type which can be cast into aSTRING. Data types suchdatesorfloatswill be converted to astringin the output and do not need to be cast beforehand. Â - The function returns either
BYTESor aSTRING. - If any input value is
NULLthen the function will returnNULLas the output.
Common Questions
How do I join a date and some text together in one column?
The CONCAT function will do this automatically, for example:
value1 [|| ...]| with_date |
|---|
| The date is: 2020-10-01 |
If you want to change the format of the date before combining it with other columns you can use the FORMAT_DATE function on the date column first. For example:
Loading code...
| with_formatted_date |
|---|
| The month is October |
Troubleshooting Common Errors
No matching signature for function CONCAT for argument types
This error occurs when one of the input columns to the CONCAT function can't be cast to a STRING or BYTES , for example an array column or struct column.
firstname || ' ' || last_nameLoading code...
Loading code...