我正在尝试编写一个查询来检索“真实”列名,因为它们是由表定义定义的,但是通过它们使用的视图。
Find the complete document with all the queries and screen dumps of the results I'am looking for
答案 0 :(得分:0)
查看列并不总是映射到表列。考虑以下(组成)视图定义。
CREATE VIEW MadeUp
AS
SELECT
GETDATE() AS CurrDate,
0 AS Zero,
object_id + schema_id AS SumId,
name + type_desc COLLATE SQL_Latin1_General_CP1_CI_AS AS SomeString,
( SELECT COUNT(*) FROM sys.tables ) AS NumTables
FROM sys.objects;
您最好的选择可能是手动检查您的视图定义以确定您需要的内容。