How to get table name from column in SQL Server and FIREDAC join query?

I'm looking for metadata on TFDQuery

(FireDAC).

I have this request:

SELECT * 
FROM Table1 t1 
INNER JOIN Table2 t2 ON t1.Code = t2.code

      

I would like to know information about the columns (table name, real column name in the table, ....)

I find this post: How to get table name from field in MSSQL join query? (equivalent to mysql_field_table) , but I don't have the same structure in FireDac.

+3


source to share


1 answer


As mentioned in RBA, you first need to include ExtendedMetaData in the connection. When finished, you can get the field column description via query.GetFieldColumn(field)

and access the table and column name with its properties ActualOriginTabName

and ActualOriginColName

.



column := query.GetFieldColumn(field);
orgTableName := column.ActualOriginTabName;
orgColumnName := column.ActualOriginColName;

      

+1


source







All Articles