How to check if a calculated column is saved?

How to check if a calculated column is saved? (MS SQL Server)

+4
source share
1 answer

Computed column attributes are available at sys.computed_columns.

select * from sys.computed_columns where is_persisted = 1 

is_persisted = 1 for the saved column, 0 otherwise.

You can link this back to sys.tables via object_id, for example.

 select t.name, c.name from sys.tables t inner join sys.computed_columns c on c.object_id = t.object_id where c.is_persisted = 1 

And change the where clause to include the table / field name according to your scenario.

+9
source

Source: https://habr.com/ru/post/1343311/


All Articles