description of view columns

  • hello all.

    I need to access to description of view columns.I know to access description of table columns.please give me one script that show description of columns of views.

  • use sp_columns <viewname>

  • elham_azizi_62 (6/12/2011)


    hello all.

    I need to access to description of view columns.I know to access description of table columns.please give me one script that show description of columns of views.

    SELECT

    COL.*

    FROM INFORMATION_SCHEMA.TABLES AS TAB

    INNER JOIN INFORMATION_SCHEMA.COLUMNS AS COL

    ON COL.TABLE_CATALOG = TAB.TABLE_CATALOG

    AND COL.TABLE_SCHEMA = TAB.TABLE_SCHEMA

    AND COL.TABLE_NAME = TAB.TABLE_NAME

    WHERE

    TAB.TABLE_TYPE = 'VIEW'

    ORDER BY

    COL.TABLE_CATALOG

    ,COL.TABLE_SCHEMA

    ,COL.TABLE_NAME

    ,COL.ORDINAL_POSITION

  • 😀

    Best Regards,
    Ashkan

  • SELECT v1.name

    FROM sys.columns v1

    INNER JOIN sys.views v2 on V1.OBJECT_ID = V2.OBJECT_ID

    and V2.NAME = 'VIEWNAME'

    Best Regards,
    Ashkan

  • elham_azizi_62 (6/12/2011)


    hello all.

    I need to access to description of view columns.I know to access description of table columns.please give me one script that show description of columns of views.

    Gosh... they're so close to each other. Did you even try?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 6 posts - 1 through 5 (of 5 total)

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