Contents

View computed columns in database

Contents

Snippet to quickly view computed column information. You can also view this by doing a “create table” script. This however, was a little cleaner to read and view for me.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

select
    database_name = db_name()
    ,object_schema_name = object_schema_name( object_id )
    ,object_name = object_name( object_id )
    ,full_object_name = object_schema_name( object_id ) + '.' + object_name( object_id )
    ,column_name = name
    ,cc.is_persisted
    ,cc.Definition
from
    sys.computed_columns cc
order
    by full_object_name asc