November 25, 2005 at 1:39 pm
What is the quickest way to find out through query analyzer?
-total number of records in table?
-total number of records in a db
I can count total tables in a db:
select count(*) from sysobjects
where type = 'U'
and name <> 'dtproperties'
November 25, 2005 at 4:29 pm
If all your tables have a clustered index then
SELECT object_name(id),SUM(rows)
FROM sysindexes
WHERE indid=1
GROUP BY object_name(id)
WITH ROLLUP
indid=1 is the clustered index
November 25, 2005 at 9:24 pm
Hi,
Total no of records in a table
select count(*) from tablename
Total number of records in a database
For userdefined table
SELECT
[TableName] = so.name,
[Table id]=so.id,
[RowCount] = MAX(si.rows)
into #Temp1 FROM
sysobjects so, sysindexes si
WHERE
so.xtype = 'U'
AND si.id = OBJECT_ID(so.name)
GROUP BY
so.name,so.id
ORDER BY
3 DESC
select sum([rowcount]) from #temp1
drop table #temp1
HTH
from
Killer
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply