Syntax error and access violation with parameters
Posted: 21.10.2015, 17:45
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
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