List views in Azure SQL database with their scripts

Bart Gawrych - Dataedo Team Bart Gawrych 2019-02-08

Table of Contents:


    Query below lists views in a database with their definition.

    Query

    select schema_name(v.schema_id) as schema_name,
           v.name as view_name,
           v.create_date as created,
           v.modify_date as last_modified,
           m.definition
    from sys.views v
    join sys.sql_modules m 
         on m.object_id = v.object_id
     order by schema_name,
              view_name;
    

    Columns

    • schema_name - view schema name
    • view_name - view name
    • created - date and time was created
    • last_modified - view last modification date and time
    • definition - view definition script including 'create view' statement

    Rows

    • One row represents one view
    • Scope of rows: all views in database
    • Ordered by schema name, view name

    Sample results

    0
    There are no comments. Click here to write the first comment.

    By continuing to use our website, you consent to the use of cookies in accordance with our Privacy Policy.
    Accept