Page 1 of 1

table name as parameter

Posted: Wed 14 Nov 2012 21:28
by FerCastro
Hello

Is it possible use a parameter name as table name un a update query object?

Something like.

update
:p_TableName
set
...
...

?

Thanks

Re: table name as parameter

Posted: Thu 15 Nov 2012 08:53
by AlexP
Hello,

You cannot pass table names in parameters, macros can be used for this, for example:

Code: Select all

  UniQuery1.SQL.Text := 'UPDATE &TABLE SET &FIELD = :VALUE';
  UniQuery1.MacroByName('TABLE').AsString := 'MyTable';
  UniQuery1.MacroByName('FIELD').AsString := 'MyField';
  UniQuery1.ParamByName('VALUE').AsString := 'MyValue';
  UniQuery1.Execute;

Re: table name as parameter

Posted: Sun 18 Nov 2012 03:57
by FerCastro
I will try, thanks a lot