Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

How to find computed columns on a SQL Server table

Question: I'm having a problem with an index rebuild job , which is failing on tables with Computed Columns. I've read  ALTER INDEX failed due to QUOTED IDENTIFIER set to OFF   which details a solution for situations of computed columns, xml data type and LOB data types.

How can I find the computed columns on sql tables?

Answer: These are two ways in which you can identify the computed columns. One method is through the sys.columns  and the other through sys.computed_columns . 

sys.computed_columns has the benefit of not requiring you to use the "is_computed = 1" predicate.

Method 1 - sys.columns

SELECT * FROM sys.columns
WHERE is_computed = 1
AND object_id = OBJECT_ID('My_Table')

Method 2 - sys.computed_columns

SELECT * FROM sys.computed_columns
WHERE object_id = OBJECT_ID('My_Table')



This post first appeared on SQLSERVER-DBA.com, please read the originial post: here

Share the post

How to find computed columns on a SQL Server table

×

Subscribe to Sqlserver-dba.com

Get updates delivered right to your inbox!

Thank you for your subscription

×