SQL查询数据库中所有表、表字段名及数据类型

select b.name,a.colid,a.name
,(select systypes.name+'('+cast(a.length/2  as varchar(10))+')' from systypes where a.xusertype=systypes.xusertype ) type
from  syscolumns a
left outer join sysobjects b
on a.id=b.id 
where b.xtype='U' 
order by b.name,a.colid

猜你喜欢

转载自blog.csdn.net/simpleshao/article/details/80609929