您的位置:首页 > 其它

获取表字段的所有信息

2009-08-22 11:51 183 查看
以 PUBS 数据库 JObs 表为例
获得表中 所有字段的信息

select * from(

select o.name as table_name,c.name as field_name,t.name as type,c.length as

length,c.isnullable as isnullable,convert(varchar(30),p.value) as desp
from syscolumns c
join systypes t on c.xtype = t.xusertype
join sysobjects o on o.id=c.id
left join sysproperties p on p.smallid=c.colid and p.id=o.id
where o.xtype='U') as mytable

where table_name ='jobs'
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: