select no. of rows from the current database
- From: "ssingh" <singh.181@xxxxxxxxx>
- Date: 19 Jul 2006 06:55:55 -0700
Hello,
I want to select the names and number of rows of all tables in the
current database, whose name starts with 'sys'
my query is:
select o.[name], sum(i.[rows]) as numbers
from sysobjects o
inner join sysindexes i
on (o.[id] = i.[id])
where o.[name] like 'sys%'and i.indid=1
group by o.[name]
the result of the query is (depending of the database) :
name numbers
sysaltfiles 14
syscharsets 114
syscolumns 4934
syscomments 2035
sysconfigures 38
sysdatabases 7
sysdepends 5524
sysdevices 6
sysfilegroups 1
sysfulltextcatalogs 0
sysfulltextnotify 0
sysindexes 98
syslanguages 33
sysmessages 3795
sysobjects 1285
syspermissions 806
sysproperties 0
sysreferences 0
sysservers 1
systypes 26
sysusers 14
sysxlogins 3
But when I count the number of rows of "sysobjects", I get
numbers=1298, which is different from the result displayed above and
same goes for "syscolumns".
I also tried "dbcc updateusage [0]" to update the SQL Server but I
didnt help me.
Can anyone please advice me on this behaviour?
.
- Follow-Ups:
- Re: select no. of rows from the current database
- From: Erland Sommarskog
- Re: select no. of rows from the current database
- Prev by Date: Re: SQL Server 2005 Script Generation
- Next by Date: Re: Book recommendations?
- Previous by thread: 2005 Express Edition: installing full-text search
- Next by thread: Re: select no. of rows from the current database
- Index(es):
Relevant Pages
|
Loading