Finding an aliased column's original name and 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.

  • I don't think this is possible without parsing the function code, which is a significant undertaking.

    ---------------------------------------
    elsasoft.org

  • Yeah I have looked into parsing sp_helptext or something like that but as you say it would be extremely involved 😛

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply