dataengref migrate

Home / SQL Server

SQL Server LEN in Snowflake, Databricks and BigQuery

Snowflake and Databricks accept LEN, and BigQuery uses LENGTH. All three count trailing spaces, while SQL Server LEN ignores them, so lengths can differ after migration.

SQL Server function: LEN(string_expression) · SQL Server docs

Equivalents

TargetSupportSyntaxNotesSource
SnowflakeSame nameLEN(expression)Alias of LENGTH. Counts characters, including trailing spaces.Snowflake docs
DatabricksSame namelen(expr)Synonym of char_length (Databricks Runtime 11.3 LTS and above). Counts trailing spaces.Databricks docs
BigQueryDifferent nameLENGTH(value)Counts characters for STRING and bytes for BYTES.BigQuery docs

Behavior differences to check

Examples

Find codes longer than 10 characters

SQL Server
SELECT code FROM products WHERE LEN(code) > 10;
Snowflake
SELECT code FROM products WHERE LEN(RTRIM(code)) > 10;
Databricks
SELECT code FROM products WHERE len(rtrim(code)) > 10;
BigQuery
SELECT code FROM products WHERE LENGTH(RTRIM(code)) > 10;

Other SQL Server functions

Last checked: · Paste a whole query into the SQL checker to find every function that needs a change.