Finding an aliased column's original name & table
Hi,
I need to find out where the columns in a number of functions are coming from. My problem is that the functions tend to pull information from more than one table and the columns are aliased within the function. I would like to query this information out of the system tables.
I am trying to write a query that will return the following:
- Column name from a given view/function (based on objectID)
- Table name of the table where the column comes from
- Column name of the column as it appears in the table (for aliased columns)
I want the query to be parameterized by passing it an objectid or objectname.
Is there a way to write this using the system tables or information_schema views? I've been trying to figure out what I could join these tables on to get this information but have so far come up with nothing.
|