sql server2008怎么实现查询某个数据库中所有的表名
4个回答
展开全部
你是要写代码生成器么?
--这是查表的数量
Select [name] from sysObjects Where xtype='U'and [name]<>'dtproperties' Order By [name]
--得到数据库中所有用户视图
Select [name] From sysObjects Where xtype='V' And [name]<>'syssegments' And [name]<>'sysconstraints' Order By [name]
--获得指定表中所有的列
Select
c.name As ColumnName,
t.name As TypeName
From syscolumns c, systypes t, sysobjects o
Where c.xtype = t.xusertype
And c.id = o.id
And o.name = 'Book'
Order By c.colorder
--这是查表的数量
Select [name] from sysObjects Where xtype='U'and [name]<>'dtproperties' Order By [name]
--得到数据库中所有用户视图
Select [name] From sysObjects Where xtype='V' And [name]<>'syssegments' And [name]<>'sysconstraints' Order By [name]
--获得指定表中所有的列
Select
c.name As ColumnName,
t.name As TypeName
From syscolumns c, systypes t, sysobjects o
Where c.xtype = t.xusertype
And c.id = o.id
And o.name = 'Book'
Order By c.colorder
展开全部
use database;
show the tables;
show the tables;
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select name from database.sys.tables
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
SELECT * FROM INFORMATION_SCHEMA.TABLES
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询