Skip to content
Advertisement

Thousands separator in sql with dot in bigquery

How to cast numeric type let say 30000 into string type with dot as thousand separator 30.000.

I tried to use

SELECT FORMAT("%'.0f", CAST(30000 as NUMERIC))

But the result is 30,000 not 30.000

Advertisement

Answer

You could just replace the , with . after formatting:

SELECT 
  REPLACE(
    FORMAT("%'.0f", CAST(30000 as NUMERIC)),
    ',',
    '.'
  )


User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement