I need help in getting list of all table used in any particular query in SQL Server whether its part of join or any subquery.
I am expecting output as below.
Lets say query is-> "select A.*, B.col1, B.col2 from table1 A inner join table2 B on A.abc=b.abc"
Expected output is list of table used in above query. which is table1, table2
Is there any way i can get the tables used for any random query?
-----------------------------------------------------------
Thankyou Everyone - I get it worked for SQL Server. I am looking for same thing for Netezza also.
Is there any equivalent for sys.dm_exec_describe_first_result_set in Netezza which can provide same results?