Trim whitespace (or specific characters) from a string.
Postgres, CockroachDB, Redshift, Oracle, DB2, Snowflake, MySQL, MariaDB,
ClickHouse: support the standard
TRIM([BOTH|LEADING|TRAILING] [chars FROM] expr) syntax.
SQLite: has no [BOTH|LEADING|TRAILING] FROM syntax; instead uses
trim(expr[, chars]) / ltrim(expr[, chars]) / rtrim(expr[, chars]).
MSSQL: TRIM (2017+) only trims both sides; for one-sided trimming we
fall back to LTRIM/RTRIM. Native LTRIM/RTRIM in MSSQL only
support a chars argument starting with SQL Server 2022, so when
chars is supplied on an older-compatible codepath it is still passed
through (SQL Server will error at runtime on versions that don't
support it — this is a documented MSSQL version limitation, not a
limitation of this helper).
Trim whitespace (or specific characters) from a string.
TRIM([BOTH|LEADING|TRAILING] [chars FROM] expr)syntax.[BOTH|LEADING|TRAILING] FROMsyntax; instead usestrim(expr[, chars])/ltrim(expr[, chars])/rtrim(expr[, chars]).TRIM(2017+) only trims both sides; for one-sided trimming we fall back toLTRIM/RTRIM. NativeLTRIM/RTRIMin MSSQL only support acharsargument starting with SQL Server 2022, so whencharsis supplied on an older-compatible codepath it is still passed through (SQL Server will error at runtime on versions that don't support it — this is a documented MSSQL version limitation, not a limitation of this helper).