Request a demo

BigQuery · String function

BigQuery CONCAT

CONCAT joins two or more values into one STRING (or BYTES): CONCAT(first_name, ' ', last_name). The || operator does the same. Both return NULL if any input is NULL, so wrap nullable columns in IFNULL or use ARRAY_TO_STRING to skip them.

GoogleSQL for BigQuery · Checked against the official reference in November 2026

CONCAT takes one or more arguments and returns them joined in order. Arguments that are not STRING, such as INT64, FLOAT64, DATE or BOOL, are cast to STRING first, so CONCAT('Order #', 42) works without an explicit CAST. All arguments must end up the same kind: you cannot mix STRING and BYTES, and you cannot pass an ARRAY or STRUCT.

The || operator is shorthand for CONCAT: 'A' || 'B' || 'C' is rewritten to nested CONCAT calls. It accepts the same coercions, but a bare NULL literal as an operand is a compile error. || also concatenates arrays of the same type.

The NULL rule is the main thing to remember: one NULL argument makes the whole result NULL. BigQuery has no CONCAT_WS. To join values with a separator and skip NULLs, put them in an array and use ARRAY_TO_STRING. To join values across rows, use STRING_AGG.

Syntax

CONCAT(value1[, ...])

value1 || value2 [|| ...]

Arguments and return value

ArgumentDescription
value1, ...One or more values. STRING and BYTES are used as is; other types that can be cast to STRING (numbers, DATE, TIMESTAMP, BOOL) are cast. STRING and BYTES can't be mixed.

Returns: STRING, or BYTES when all arguments are BYTES. NULL if any argument is NULL.

Examples

Build a label from text and numbers

Non-string arguments are cast to STRING automatically, both in CONCAT and with ||.

SELECT
  CONCAT('Order #', 42, ' shipped on ', DATE '2026-11-23') AS label,
  'INV-' || 2026 || '-' || 'EU' AS invoice_prefix;
Result
labelinvoice_prefix
Order #42 shipped on 2026-11-23INV-2026-EU

One NULL makes the whole result NULL

ARRAY_TO_STRING skips NULL elements, which makes it the BigQuery replacement for CONCAT_WS.

WITH customers AS (
  SELECT 'Ada' AS first_name, CAST(NULL AS STRING) AS middle_name, 'Lovelace' AS last_name UNION ALL
  SELECT 'Alan', 'Mathison', 'Turing'
)
SELECT
  CONCAT(first_name, ' ', middle_name, ' ', last_name) AS with_concat,
  ARRAY_TO_STRING([first_name, middle_name, last_name], ' ') AS with_array_to_string
FROM customers
ORDER BY first_name;
Result
with_concatwith_array_to_string
NULLAda Lovelace
Alan Mathison TuringAlan Mathison Turing

Build a composite key with a separator

WITH events AS (
  SELECT 'web' AS source, 1001 AS user_id, DATE '2026-11-23' AS event_date
)
SELECT CONCAT(source, ':', user_id, ':', FORMAT_DATE('%Y%m%d', event_date)) AS event_key
FROM events;
Result
event_key
web:1001:20261123

Common mistakes

  • Forgetting that NULL propagates. CONCAT(first_name, ' ', middle_name) returns NULL for every row with no middle name. Wrap optional parts in IFNULL(middle_name, '') or use ARRAY_TO_STRING([...], ' ').
  • Looking for CONCAT_WS. It exists in MySQL, PostgreSQL, Snowflake and Redshift but not in BigQuery (Function not found: CONCAT_WS). Use ARRAY_TO_STRING([a, b, c], '-').
  • Writing 'text' || NULL. A literal NULL operand of || fails to compile with Operands of || cannot be literal NULL; a NULL column just returns NULL.
  • Mixing STRING and BYTES, or passing an ARRAY. Both fail with a No matching signature error. CAST BYTES to STRING, and use ARRAY_TO_STRING for arrays.
  • Expecting + to concatenate as in SQL Server. In BigQuery 'a' + 'b' fails with No matching signature for operator +; use CONCAT or ||.

FAQ

How do I concatenate strings with a separator in BigQuery?

Use ARRAY_TO_STRING([col1, col2, col3], ', '). It works like CONCAT_WS and skips NULL elements. Pass a third argument, such as '', to keep NULL positions as that text.

What is the difference between CONCAT and || in BigQuery?

None in the result: a || b is rewritten to CONCAT(a, b). CONCAT takes any number of arguments in one call, and || also concatenates arrays.

How do I concatenate values from multiple rows?

Use the aggregate STRING_AGG: STRING_AGG(product_name, ', ' ORDER BY product_name) returns one string per group.

Why does CONCAT return NULL?

At least one argument is NULL. Replace NULLs with IFNULL or COALESCE before concatenating.

Errors you may hit

More string functions

All BigQuery string functions · All functions · BigQuery error messages

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.