Page 1 of 1

Prepare - The data types nvarchar and sql_variant are incompatible in the add operator.

Posted: Mon 22 Sep 2014 09:49
by AndreasNeef
Hello!

We're using odac in Delphi for years and we're now extending our software to use sdac 6.10.21 and odac 9.3.10 at the same time. The following code raises an Error in sdac, when executing the prepare.

Code: Select all

qry: TMSQuery;
...
qry.SQL.Text := 'SELECT name FROM sys.objects WHERE name = :sName And type_desc LIKE ''%'' + :sTyp + ''%''';
qry.Prepare;
...
When we put the '%' into the parameter instead of the sql-statement, it works fine. In the forum we've read about defining the parameters datatype before preparing. Is there any other solution for our problem? In odac this code sequences works perfect (with || instead of +).

Yours sincerely

Andreas

Re: Prepare - The data types nvarchar and sql_variant are incompatible in the add operator.

Posted: Wed 24 Sep 2014 12:20
by azyk
In you case, this error is returned by SQL Server, and we can't affect this behavior. Have a look at the discussion at MSDN for alternative solutions for this problem: http://social.msdn.microsoft.com/Forums ... ngservices