View

  • Can u plz share a query which will retrive below information from a view?

    1. Columns names of the view

    2. Name of the tables and corresponding columns view is referring to

    Many thanks in advance

  • As Far as I Know, there is nothing that has a mapping that says viewname.column1 comes from tablename.somecolumn3;

    obviously reading the code itself might help, but remember the column could be calculated or from a different view;

    two procs can help somewhat:

    exec sp_help your_view_name

    exec sp_depends your_view_name

    one gives you the column names used in the view, and the other gives you the source columns themselves, but they are not mapped to the view column names.

    maybe reading the code for sp_depends might reveal a way to directly map those aliases from the view?

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

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

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