SELECT c.name, t.name, c.max_length, c.precision, c.scale FROM SYS.COLUMNS c JOIN SYS.TYPES t ON t.user_type_id = c.user_type_id AND t.system_type_id = c.system_type_id WHERE object_id = OBJECT_ID('TABLENAME/VIEWNAME')
透過INFORMATION_SCHEMA.COLUMNS查詢
1 2 3
SELECT* FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME ='TABLENAME/VIEWNAME'