Get List of Computed Columns in Database Table (SQL Server)

Viewed 37855

Would any of you know how to get the list of computed columns in a SQL Server database table?

I found sys.sp_help tablename does return this information, but only in the second result-set.

I am trying to find out if there is a better way of doing this. Something which only returns a single result set.

4 Answers

If you have many tables with computed columns and want to see the table names as well:

SELECT sys.objects.name, sys.computed_columns.name
from sys.computed_columns 
inner join sys.objects on sys.objects.object_id = sys.computed_columns.object_id
order by sys.objects.name
Related