查询数据库的所有表名:
select b.name tablename
from sys.objects b where b.type='u' order by b.name
查询数据库的所有表名及表对应的字段:
select b.name tablename,a.name as columnname
from sys.columns a,
sys.objects b,
sys.types c
where a.object_id=b.object_id
and a.user_type_id=c.user_type_id
and b.type='u'
order by b.name
版权声明:本文为huang_yun_dong原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。