On 2006-09-15, Poul Jensen <[EMAIL PROTECTED]> wrote:
> 2) The code below was meant to find the # of distinct elements for many 
> columns, but fails with the message
>     sql error 'non-integer constant in GROUP BY'
>     thrown at the EXEC SQL EXECUTE statement. What is the problem?

>   char dbnm[50], *stmt = "SELECT ? FROM beamdata GROUP BY ?;";

That statement is not legal - parameters can only be used to substitute
_data_, not identifiers or syntax.

You would have to interpolate the column name directly into the query
(remembering to quote it with "" if needed) rather than use a parameter
for it.

-- 
Andrew, Supernews
http://www.supernews.com - individual and corporate NNTP services

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to