Page 1 of 1

execute sql with parameters already replaced

Posted: Tue 13 Oct 2015 07:35
by Ludek
Hi,
I have a query text, where the parameters have already been replace with question marks:

select ?, ?, ?

and I have also orderer list of the corresponding values in array of variant.

How do i execute such query?
I tried TMSConnection.ExecSQL, but this method expects named parameters in the sql text (:param1, :param2 etc.)

Thanks, Ludek.

Re: execute sql with parameters already replaced

Posted: Tue 13 Oct 2015 09:04
by ViktorV
For successful execution of the specified query, you should modify it to the following:

Code: Select all

select :p1, :p2, :p3
SDAC generates parameters automatically, using the SQL query text.

Re: execute sql with parameters already replaced

Posted: Tue 13 Oct 2015 11:40
by Ludek
... and sdac again parses all the params and changes it internally again back to ?, ?, ?...
I hoped, i could save this superfluous parsing and replacing using some low-level access, especially when the query contains 2000 parameters...

Re: execute sql with parameters already replaced

Posted: Tue 13 Oct 2015 12:39
by ViktorV
When parsing a query, we replace not just all the :ParamName entries with ?, but also create an internal structure for using parameters. So you can't use a query, in which parameter names are replaced with ?.