Category / Section
How to use the TRIM in SQL Server 2016 and below
Published:
Problem
During the process of creating expressions in Bold BI, there may be instances where you encounter an issue such as “TRIM is not recognized as a built-in function name” when using a SQL Server data source.
Reason
- TRIM() function is not supported in SQL Server 2016 and earlier versions
- This implies that if you attempt to use the TRIM function in SQL 2016 or earlier, you will encounter an error message stating, “TRIM is not a recognized built-in function name.”
Solution
-
SQL Server 2016 or earlier uses the LTRIM function to remove spaces or characters on the leading (left) side of a string and RTRIM to remove them on the trailing side (right).
Example:
SELECT RTRIM(LTRIM([column])) AS TRIM_VALUE from [Table_name];