Page 1 of 1

Error Using TRIM in Unified SQL

Posted: Thu 10 Dec 2009 21:14
by jayfaubion
I got back an exception when trying to use TRIM in a SELECT statement. The error was returned as an "EUNIERROR", with the text "'TRIM' is not a recognized built-in function name."

This was directed to a SQL Server target. Can you suggest how I may correct my code?

Here is the actual example:

q := TUniQuery.Create(nil);
try
q.Name := 'q';
q.Connection := frmDesktop.dbLocal;
q.SQL.text := 'Select Count(*) from ord_paym WHERE Order_no= ''' + Order_no +
''' and pay_ref =''EM'' and TRIM(aba_no) in (' + spromo + ')';
q.open;
if q.FieldByName('count(*)').AsInteger > 0 then
Result := True;
q.Close;
finally
freeandNil(q);
end;

Posted: Fri 11 Dec 2009 07:01
by tobias_cd
For SQL Server the correct functions are "LTRIM" or "RTRIM", not "TRIM".