vijay Panner wrote:Hi,
I want to get table name and column name from query. i got column name. but i didn't get table name from the query. Please help me
I suppose that you've run a SQL query and are reading it using a resultset, and you're trying to obtain column and table names from the resultset.
The resultset does not contain column's table names, generally because it is not always possible to assign a table to a column in resultset. Consider this:
Which table do columns
A and
B come from? And while the column
C comes clearly from table
T1, that table actually might not have a column named
C at all.
If you're interested just in a set of tables a query uses, it might be possible to extract this information from the text of the SQL query. However, you'd need to parse the query according to the SQL syntax of the target database to do this for arbitrary SQL queries, which seems like a lot of work to me.