user3651708 user3651708 - 4 months ago 5
SQL Question

How to get only not auto computed columns from a table?

I have This query

SELECT COLUMN_NAME
FROM [INFORMATION_SCHEMA.COLUMNS]
WHERE TABLE_NAME = @TableName
AND TABLE_SCHEMA = @TableSchema;


The thing is this query returns all the table's columns but what I want is to only return the not auto computed columns.
Any suggestions.

Answer

Use sys.columns instead, it has a column called is_computed

Comments