How Can I Check Whether My Database Contains Computed Columns?
Question
As mentioned in Fivetran's SQL Server limitations documentation, Fivetran doesn't sync computed columns for connectors using change data capture (CDC) as the incremental sync method because CDC doesn't support those columns. How can I check whether my database contains computed columns?
Environment
The following SQL Server databases:
- Generic SQL Server
- Amazon SQL Server RDS
- Azure SQL Database
- Azure SQL Managed Instance
- Google Cloud SQL for SQL Server
Answer
You can check whether your database contains computed columns by querying the sys.computed_columns
SQL Server catalog view.
To see a list of the computed columns contained within your database, use the following query:
SELECT name AS [Computed Column], is_computed FROM sys.computed_columns WHERE is_computed = 1 order by name;
To see a list of the computed columns contained with a table, use the following query, replacing <schema_table_name>
with your schema table name:
SELECT name AS [Computed Column] FROM sys.computed_columns WHERE object_id = OBJECT_ID('<schema_table_name>');