Skip to content

Instantly share code, notes, and snippets.

@troyscott
Created April 4, 2013 18:00
Show Gist options
  • Select an option

  • Save troyscott/5312598 to your computer and use it in GitHub Desktop.

Select an option

Save troyscott/5312598 to your computer and use it in GitHub Desktop.
List of computed columns by table for a database.
select
s.name SchemaName
,object_name(cc.object_id) as TableName
,c.is_computed
,cc.name
,cc.column_id
,cc.definition
from sys.computed_columns cc inner join sys.columns c
on cc.object_id = c.object_id and cc.column_id = c.column_id
inner join sys.tables t on t.object_id = c.object_id
inner join sys.schemas s on s.schema_id = t.schema_id
order by SchemaName, TableName, c.column_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment