我想搜索列是否参与计算列表达式。
我想出了这个
SELECT
(select name
from sys.columns
where column_id = sys.sql_expression_dependencies.referencing_minor_id
and object_id = sys.sql_expression_dependencies.referencing_id) as [dependant_column]
FROM sys.sql_expression_dependencies
WHERE referencing_minor_id > 0
and referencing_class = 1
and referenced_class = 1
and object_name(referencing_id) = 'trns1'
and referenced_minor_id = (select column_id
from sys.columns
where name = 'class1'
and OBJECT_NAME(object_id) = 'trns1')
请帮忙。
答案 0 :(得分:3)
您想查看sys.computed_columns表:
select name, definition
from sys.computed_columns
这是一个非常相似的问题:SQL Server: Computed Column defintions retrievable from Database?
可能会有更多的事情发生。