Syntax error and access violation with parameters

The official tester's forum for ZeosLib 7.1. Ask for help, post proposals or solutions.
Post Reply
Cadrach
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 21.10.2015, 17:32

Syntax error and access violation with parameters

Post by Cadrach »

At the moment i migrating an old project to XE8.

i use zeos 7.1.4-stable with protocol ado to connect to an SQL-Server.

when i execute a query with the following SQL:
"DECLARE @param varchar(20);
SET @param=:param

SELECT *
FROM (
SELECT 1 as abc
) as sub
WHERE sub.abc=@param
"

i got an EOleException with "syntax error or access violation".

"DECLARE @param varchar(20);
SELECT *
FROM (
SELECT 1 as abc
) as sub
WHERE sub.abc=:param"

works fine. In the old version the SQL on top also works.

Has anybody an idea:
- where to search for the error?
- an idea for an workaround?

it's important to specify the param first in a variable, because in the original code there is a lot of string replace and so on around the parameter. i just isolated the problem to the sql code above.


Best Regards,

Thomas
Post Reply