How to pass the object name into X++ query

Hi all,

Did anyone have experience to pass fieldid to the X++ SQL query? I try to work with a common class for the data update for any field.

Thank you and below is the idea for my work:

void updatefield(fieldid _fieldid)

SELECT forupdate firstonly InventTable where InventTable.itemid==this.itemid;

inventtable._fieldid=“123”;

inventTable.(_fieldId) = ‘123’;

That’s work, thank you for your help.