Skip to content

Instantly share code, notes, and snippets.

@karenpayneoregon
Created April 24, 2026 23:32
Show Gist options
  • Select an option

  • Save karenpayneoregon/63b565685d7800b1cecc7c43333ec5ff to your computer and use it in GitHub Desktop.

Select an option

Save karenpayneoregon/63b565685d7800b1cecc7c43333ec5ff to your computer and use it in GitHub Desktop.
For SQL Server get computed column names and definitions
SELECT SCHEMA_NAME(o.schema_id) AS schema_name,
c.name AS column_name,
OBJECT_NAME(c.object_id) AS table_name,
TYPE_NAME(c.user_type_id) AS data_type,
c.definition
FROM sys.computed_columns c
JOIN sys.objects o
ON o.object_id = c.object_id
ORDER BY schema_name,
table_name,
c.column_id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment