日期:2014-05-17  浏览次数:20606 次

如何能让企业管理器中数据库列表能显示各表的行数、字节数行数?
    我用的是SQL Server 2000年版,在企业管理器中,双击其一数据库项下的表,可以显示该数据库所有的表名、所有者、类型、创建日期,能否增加显示各表的行数、字节数、最新修改日期?(或用其他方法通过列表的形式显示数据库所有表的名称、类型、行数、字节数、创建日期、最新修改日期。)敬向电脑专家请教,不胜感激!

------解决方案--------------------
select * from sysobjects where xtype='u'

------解决方案--------------------
表名,行数,创建日期

set nocount on
if object_id(N'tempdb.db.#temp') is not null
drop table #temp
create table #temp (name sysname,count numeric(18),crdate datetime)
insert into #temp
select o.name,i.rows,o.crdate 
from sysobjects o,sysindexes i  
where o.id=i.id and o.Xtype='U' and i.indid<2
--select count(count) 总表数,sum(count) 总记录数 from #temp
select * from #temp order by name
set nocount off

------解决方案--------------------

select a.name '名称',
       a.xtype '类型',
       b.rowcnt '行数',
       b.reserved*8 '字节数(KB)',
       a.crdate '创建日期',
       a.refdate '最新修改日期'
 from sysobjects a
 inner join sysindexes b on a.id=b.id
 where a.xtype in('U','S') and b.indid<=1