码迷,mamicode.com
首页 > 数据库 > 详细

SQL查询所有表,所有列

时间:2016-12-30 19:38:17      阅读:355      评论:0      收藏:0      [点我收藏+]

标签:sql查询   cts   inf   查询   tab   数据   objects   sch   实例   

1.查询实例中所有数据库

select name,database_id from sys.databases

2.查询数据库中所有表
select TABLE_TYPE,TABLE_NAME from information_schema.tables order by TABLE_NAME

select * from sysobjects where type=‘U‘ order by name(所有表)
select * from sysobjects where type=‘SQ‘ order by name
select * from sysobjects where type=‘FN‘ order by name
select * from sysobjects where type=‘S‘ order by name
select * from sysobjects where type=‘D‘ order by name
select * from sysobjects where type=‘IT‘ order by name
select * from sysobjects where type=‘F‘ order by name
select * from sysobjects where type=‘F‘ order by name
select * from sysobjects where type=‘PK‘ order by name(所有主键)
select * from sysobjects where type=‘P‘ order by name
select * from sysobjects where type=‘TF‘ order by name
select * from sysobjects where type=‘C‘ order by name
select * from sysobjects where type=‘UQ‘ order by name
select * from sysobjects where type=‘V‘ order by name(所有视图)

SQL查询所有表,所有列

标签:sql查询   cts   inf   查询   tab   数据   objects   sch   实例   

原文地址:http://www.cnblogs.com/shenguanyu/p/6237871.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!