Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个用于传输数据的 SQL Server 2005 数据库,在这个数据库中我们有 30-40 个视图。
我需要报告这些视图公开的所有列。
有没有办法查询数据库中的所有视图并输出这些列?
谢谢
SELECT [schema] = s.name, [view] = v.name, [column] = c.name FROM sys.views AS v INNER JOIN sys.schemas AS s ON v.[schema_id] = s.[schema_id] INNER JOIN sys.columns AS c ON v.[object_id] = c.[object_id] ORDER BY [schema],[view],c.column_id;