SQL查数据库表,字段
//查表
select name from sysobjects where xtype='u'
//查列
select
c.name as cname,t.name as [type],c.max_length as [length],(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='tb_orders' order by c.column_id
列名 类型 长度 备注
ord_Id uniqueidentifier 16 订单id 对内标识码