Error Using TRIM in Unified SQL

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jayfaubion
Posts: 3
Joined: Wed 02 Dec 2009 19:36

Error Using TRIM in Unified SQL

Post by jayfaubion » Thu 10 Dec 2009 21:14

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;

tobias_cd
Posts: 56
Joined: Thu 18 Dec 2008 22:10

Post by tobias_cd » Fri 11 Dec 2009 07:01

For SQL Server the correct functions are "LTRIM" or "RTRIM", not "TRIM".

Post Reply