Subject Re: [ib-support] SQL add?
Author hans@hoogstraat.ca
Closest 'Dynamic' I can think of:

Close;
SQL.Text := Format('SELECT * FROM %s ORDER BY %s',
DtrTable,CODE]);
Open;

===================================================

> SQL.Clear;
> SQL.Add('SELECT * FROM :TABLE');
> SQL.Add('ORDER BY :CODE');
> Parambyname('TABLE').asString := StrTable;
> ParamByName('CODE').asstring := CODE;
> Open;
> end;

Daniel Bertin wrote:
>
> Hi,
> I seems that you are right, I cannot pass the table name this way, after
> changing the query to;
> with QRYT do
> begin
> Close;
> SQL.Clear;
> SQL.Add('SELECT * FROM :TABLE');
> SQL.Add('ORDER BY :CODE');
> Parambyname('TABLE').asString := StrTable;
> ParamByName('CODE').asstring := CODE;
> Open;
> end;
>
> I get the error;
> error 335544569
> SQL error = -104
> token unknown line1, char 15
> TIBOInternaldataset...
>
> Is there another way?
>
> Thanks
> Daniel
>
> At 04:41 PM 05/04/2002 -0400, you wrote:
> >At 05/04/2002 04:42 PM, you wrote:
> > >Hi all,
> > >Why can I not execute this query? I get unknown table name error. but if I
> > >replace the params with the values it's ok. what am I missing?
> >
> >The table name has to be known and it can't be a parameter.
> >
> >
> >Daniel Rail
> >Senior System Engineer
> >ACCRA Group Inc. (www.accra.ca)
> >ACCRA Med Software Inc. (www.accramed.ca)
> >
> >
> >Yahoo! Groups Sponsor
> >ADVERTISEMENT
> http://rd.yahoo.com/M=215002.1954253.3462811.1261774/D=egroupweb/S=1705115386:HM/A=1000239/R=0/*http://ads.x10.com/?bHlhaG9vaG0xLmRhd=1018040054%3eM=215002.1954253.3462811.1261774/D=egroupweb/S=1705115386:HM/A=1000239/R
> >faa31e.jpg
> >
> >To unsubscribe from this group, send an email to:
> >ib-support-unsubscribe@egroups.com
> >
> >
> >
> >Your use of Yahoo! Groups is subject to the
> ><http://docs.yahoo.com/info/terms/>Yahoo! Terms of Service.
>
> [Non-text portions of this message have been removed]
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/