根据数据库表名查询该表字段名、字段类型、以及注释

select
c.name as column_name,t.name as data_type,
(select value from sys.extended_properties as ex where ex.major_id = c.object_id and ex.minor_id = c.column_id) as notes
from
 sys.columns as c inner join sys.tables as ta on c.object_id=ta.object_id inner join 
(select name,system_type_id from sys.types where name<>'sysname') as t on c.system_type_id=t.system_type_id
where  ta.name='PE_Address' order by c.column_id

 

'PE_Address' 为要查询的数据表名;

 

根据数据库表名查询该表字段名、字段类型、以及注释

你可能感兴趣的:(数据库)