A quick one to people who import BAQs from system to system (possibly from other developer environments). Make sure you Analyse and Test the BAQ, to confirm it runs correctly in your system.
I recently had the pleasure of working through a really simple imported BAQ that was throwing a SQL error.
As it turns out there was a calculated field that used the TRIM function. TRIM is not supported on SQL 2016 which is what we use. The source environment were the BAQ was created was SQL 2017.
Clicking the Check Syntax Button produced.
I change the TRIM old LTRIM(RTRIM(x)) formula to fix it.
Hopefully someone finds it useful.