Query below lists all columns in views in Azure SQL database
Query
select schema_name(v.schema_id) as schema_name,
object_name(c.object_id) as view_name,
c.column_id,
c.name as column_name,
type_name(user_type_id) as data_type,
c.max_length,
c.precision
from sys.columns c
join sys.views v
on v.object_id = c.object_id
order by schema_name,
view_name,
column_id;
Columns
- schema_name - view owner, schema name
- view_name - view name
- column_id - column number in view
- column_name - column name
- data_type - column datatype
- max_length - data type max length
- precision - data type precision
Rows
- One row represents one column in a specific view in a database
- Scope of rows: all columns in views in Azure SQL database
- Ordered by schema name, view name and column position