select (selectcount(*) as 用户数据表 from 数据库名.dbo.sysobjects where xtype='u'and status>=0) as 用户数据表, (selectcount(*) as 用户存储过程 from 数据库名.dbo.sysobjects where xtype='P'and status>=0) as 用户存储过程, (selectcount(*) as 用户视图 from 数据库名.dbo.sysobjects where xtype='V'and status>=0) as 用户视图, (selectcount(*) as 触发器 from 数据库名.dbo.sysobjects where xtype='TR'and status>=0) as 触发器
系统存储过程:数据库信息
A. 返回有关单个数据库的信息 下面的示例显示有关 pubs 数据库的信息。 exec sp_helpdb pubs B. 返回有关所有数据库的信息 下面的示例显示有关运行 Microsoft® SQL Server™ 的服务器上的所有数据库的信息。 exec sp_helpdb
select (select count(*) as 用户数据表 from 数据库名.dbo.sysobjects where xtype=u and status>=0) as 用户数据表, (select count(*) as 用户存储过程 from 数据库名.dbo.sysobjects where xtype=P and status>=0) as 用户存储