SQL Server取视图和视图的字段
SELECT v.name AS ViewName, c.name AS ColumnName FROM sys.views v INNER JOIN sys.columns c ON v.object_id = c.object_id WHERE v.name = 'YourViewName'
SELECT m.definition AS ViewDefinition FROM sys.views v INNER JOIN sys.sql_modules m ON v.object_id = m.object_id WHERE v.name = 'YourViewName'